diff options
author | lash <nolash@users.noreply.github.com> | 2018-12-21 13:22:11 +0800 |
---|---|---|
committer | Viktor TrĂ³n <viktor.tron@gmail.com> | 2018-12-21 13:22:11 +0800 |
commit | e1edfe0689966d5b5fcee530a96c31dd28aea95c (patch) | |
tree | 7b595e06f6977b25f5b8c8a35847f4e84e07ffa1 /swarm | |
parent | 27ce4eb78bdf5d9b742ed05babe9b86a434733a1 (diff) | |
download | dexon-e1edfe0689966d5b5fcee530a96c31dd28aea95c.tar.gz dexon-e1edfe0689966d5b5fcee530a96c31dd28aea95c.tar.zst dexon-e1edfe0689966d5b5fcee530a96c31dd28aea95c.zip |
p2p/simulation: Test snapshot correctness and minimal benchmark (#18287)
* p2p/simulation: WIP minimal snapshot test
* p2p/simulation: Add snapshot create, load and verify to snapshot test
* build: add test tag for tests
* p2p/simulations, build: Revert travis change, build test sym always
* p2p/simulations: Add comments, timeout check on additional events
* p2p/simulation: Add benchmark template for minimal peer protocol init
* p2p/simulations: Remove unused code
* p2p/simulation: Correct timer reset
* p2p/simulations: Put snapshot check events in buffer and call blocking
* p2p/simulations: TestSnapshot fail if Load function returns early
* p2p/simulations: TestSnapshot wait for all connections before returning
* p2p/simulation: Revert to before wait for snap load (5e75594)
* p2p/simulations: add "conns after load" subtest to TestSnapshot
and nudge
Diffstat (limited to 'swarm')
-rw-r--r-- | swarm/network/simulation/simulation_test.go | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/swarm/network/simulation/simulation_test.go b/swarm/network/simulation/simulation_test.go index ca8599d7c..4667a2abc 100644 --- a/swarm/network/simulation/simulation_test.go +++ b/swarm/network/simulation/simulation_test.go @@ -26,9 +26,8 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" + "github.com/ethereum/go-ethereum/p2p/simulations" "github.com/ethereum/go-ethereum/p2p/simulations/adapters" - "github.com/ethereum/go-ethereum/rpc" colorable "github.com/mattn/go-colorable" ) @@ -182,39 +181,23 @@ func noopServiceFunc(ctx *adapters.ServiceContext, b *sync.Map) (node.Service, f return newNoopService(), nil, nil } -// noopService is the service that does not do anything -// but implements node.Service interface. -type noopService struct{} - func newNoopService() node.Service { return &noopService{} } -func (t *noopService) Protocols() []p2p.Protocol { - return []p2p.Protocol{} -} - -func (t *noopService) APIs() []rpc.API { - return []rpc.API{} -} - -func (t *noopService) Start(server *p2p.Server) error { - return nil -} - -func (t *noopService) Stop() error { - return nil -} - -// a helper function for most basic noop service -// of a different type then noopService to test +// a helper function for most basic Noop service +// of a different type then NoopService to test // multiple services on one node. func noopService2Func(ctx *adapters.ServiceContext, b *sync.Map) (node.Service, func(), error) { return new(noopService2), nil, nil } -// noopService2 is the service that does not do anything +// NoopService2 is the service that does not do anything // but implements node.Service interface. type noopService2 struct { - noopService + simulations.NoopService +} + +type noopService struct { + simulations.NoopService } |