diff options
author | lash <nolash@users.noreply.github.com> | 2018-12-22 13:53:30 +0800 |
---|---|---|
committer | Viktor TrĂ³n <viktor.tron@gmail.com> | 2018-12-22 13:53:30 +0800 |
commit | 5e4fd8e7dbfe701b3b544c52c433c5d7c2e302c3 (patch) | |
tree | ea38f47b568dbd0841a1e4e4fd51105d5f26a0e2 /swarm/network/stream | |
parent | 880de230b44e20282abdef0f1f9a3294ce68e5d8 (diff) | |
download | dexon-5e4fd8e7dbfe701b3b544c52c433c5d7c2e302c3.tar.gz dexon-5e4fd8e7dbfe701b3b544c52c433c5d7c2e302c3.tar.zst dexon-5e4fd8e7dbfe701b3b544c52c433c5d7c2e302c3.zip |
swarm/network: Revised depth and health for Kademlia (#18354)
* swarm/network: Revised depth calculation with tests
* swarm/network: WIP remove redundant "full" function
* swarm/network: WIP peerpot refactor
* swarm/network: Make test methods submethod of peerpot and embed kad
* swarm/network: Remove commented out code
* swarm/network: Rename health test functions
* swarm/network: Too many n's
* swarm/network: Change hive Healthy func to accept addresses
* swarm/network: Add Healthy proxy method for api in hive
* swarm/network: Skip failing test out of scope for PR
* swarm/network: Skip all tests dependent on SuggestPeers
* swarm/network: Remove commented code and useless kad Pof member
* swarm/network: Remove more unused code, add counter on depth test errors
* swarm/network: WIP Create Healthy assertion tests
* swarm/network: Roll back health related methods receiver change
* swarm/network: Hardwire network minproxbinsize in swarm sim
* swarm/network: Rework Health test to strict
Pending add test for saturation
And add test for as many as possible up to saturation
* swarm/network: Skip discovery tests (dependent on SuggestPeer)
* swarm/network: Remove useless minProxBinSize in stream
* swarm/network: Remove unnecessary testing.T param to assert health
* swarm/network: Implement t.Helper() in checkHealth
* swarm/network: Rename check back to assert now that we have helper magic
* swarm/network: Revert WaitTillHealthy change (deferred to nxt PR)
* swarm/network: Kademlia tests GotNN => ConnectNN
* swarm/network: Renames and comments
* swarm/network: Add comments
Diffstat (limited to 'swarm/network/stream')
-rw-r--r-- | swarm/network/stream/common_test.go | 3 | ||||
-rw-r--r-- | swarm/network/stream/delivery_test.go | 3 | ||||
-rw-r--r-- | swarm/network/stream/intervals_test.go | 1 | ||||
-rw-r--r-- | swarm/network/stream/snapshot_retrieval_test.go | 1 | ||||
-rw-r--r-- | swarm/network/stream/snapshot_sync_test.go | 7 | ||||
-rw-r--r-- | swarm/network/stream/syncer_test.go | 1 | ||||
-rw-r--r-- | swarm/network/stream/visualized_snapshot_sync_sim_test.go | 2 |
7 files changed, 4 insertions, 14 deletions
diff --git a/swarm/network/stream/common_test.go b/swarm/network/stream/common_test.go index e0a7f7e12..29b917d39 100644 --- a/swarm/network/stream/common_test.go +++ b/swarm/network/stream/common_test.go @@ -35,7 +35,6 @@ import ( p2ptest "github.com/ethereum/go-ethereum/p2p/testing" "github.com/ethereum/go-ethereum/swarm/network" "github.com/ethereum/go-ethereum/swarm/network/simulation" - "github.com/ethereum/go-ethereum/swarm/pot" "github.com/ethereum/go-ethereum/swarm/state" "github.com/ethereum/go-ethereum/swarm/storage" "github.com/ethereum/go-ethereum/swarm/testutil" @@ -57,7 +56,7 @@ var ( bucketKeyRegistry = simulation.BucketKey("registry") chunkSize = 4096 - pof = pot.DefaultPof(256) + pof = network.Pof ) func init() { diff --git a/swarm/network/stream/delivery_test.go b/swarm/network/stream/delivery_test.go index f537c1323..5c1f8c251 100644 --- a/swarm/network/stream/delivery_test.go +++ b/swarm/network/stream/delivery_test.go @@ -453,8 +453,6 @@ func TestDeliveryFromNodes(t *testing.T) { } func testDeliveryFromNodes(t *testing.T, nodes, conns, chunkCount int, skipCheck bool) { - - t.Skip("temporarily disabled as simulations.WaitTillHealthy cannot be trusted") sim := simulation.New(map[string]simulation.ServiceFunc{ "streamer": func(ctx *adapters.ServiceContext, bucket *sync.Map) (s node.Service, cleanup func(), err error) { node := ctx.Config.Node() @@ -543,6 +541,7 @@ func testDeliveryFromNodes(t *testing.T, nodes, conns, chunkCount int, skipCheck } log.Debug("Waiting for kademlia") + // TODO this does not seem to be correct usage of the function, as the simulation may have no kademlias if _, err := sim.WaitTillHealthy(ctx, 2); err != nil { return err } diff --git a/swarm/network/stream/intervals_test.go b/swarm/network/stream/intervals_test.go index 668cf586c..7c7feeb11 100644 --- a/swarm/network/stream/intervals_test.go +++ b/swarm/network/stream/intervals_test.go @@ -53,7 +53,6 @@ func TestIntervalsLiveAndHistory(t *testing.T) { func testIntervals(t *testing.T, live bool, history *Range, skipCheck bool) { - t.Skip("temporarily disabled as simulations.WaitTillHealthy cannot be trusted") nodes := 2 chunkCount := dataChunkCount externalStreamName := "externalStream" diff --git a/swarm/network/stream/snapshot_retrieval_test.go b/swarm/network/stream/snapshot_retrieval_test.go index 62b53fad3..a85d72329 100644 --- a/swarm/network/stream/snapshot_retrieval_test.go +++ b/swarm/network/stream/snapshot_retrieval_test.go @@ -246,7 +246,6 @@ simulation's `action` function. The snapshot should have 'streamer' in its service list. */ func runRetrievalTest(chunkCount int, nodeCount int) error { - sim := simulation.New(retrievalSimServiceMap) defer sim.Close() diff --git a/swarm/network/stream/snapshot_sync_test.go b/swarm/network/stream/snapshot_sync_test.go index 40b4327fd..f86d9acca 100644 --- a/swarm/network/stream/snapshot_sync_test.go +++ b/swarm/network/stream/snapshot_sync_test.go @@ -182,8 +182,6 @@ func streamerFunc(ctx *adapters.ServiceContext, bucket *sync.Map) (s node.Servic } func testSyncingViaGlobalSync(t *testing.T, chunkCount int, nodeCount int) { - - t.Skip("temporarily disabled as simulations.WaitTillHealthy cannot be trusted") sim := simulation.New(simServiceMap) defer sim.Close() @@ -332,7 +330,6 @@ kademlia network. The snapshot should have 'streamer' in its service list. */ func testSyncingViaDirectSubscribe(t *testing.T, chunkCount int, nodeCount int) error { - t.Skip("temporarily disabled as simulations.WaitTillHealthy cannot be trusted") sim := simulation.New(map[string]simulation.ServiceFunc{ "streamer": func(ctx *adapters.ServiceContext, bucket *sync.Map) (s node.Service, cleanup func(), err error) { n := ctx.Config.Node() @@ -555,9 +552,7 @@ func mapKeysToNodes(conf *synctestConfig) { np, _, _ = pot.Add(np, a, pof) } - var kadMinProxSize = 2 - - ppmap := network.NewPeerPotMap(kadMinProxSize, conf.addrs) + ppmap := network.NewPeerPotMap(network.NewKadParams().MinProxBinSize, conf.addrs) //for each address, run EachNeighbour on the chunk hashes pot to identify closest nodes log.Trace(fmt.Sprintf("Generated hash chunk(s): %v", conf.hashes)) diff --git a/swarm/network/stream/syncer_test.go b/swarm/network/stream/syncer_test.go index 3e3cee18d..27ed49ea4 100644 --- a/swarm/network/stream/syncer_test.go +++ b/swarm/network/stream/syncer_test.go @@ -69,7 +69,6 @@ func createMockStore(globalStore mock.GlobalStorer, id enode.ID, addr *network.B func testSyncBetweenNodes(t *testing.T, nodes, conns, chunkCount int, skipCheck bool, po uint8) { - t.Skip("temporarily disabled as simulations.WaitTillHealthy cannot be trusted") sim := simulation.New(map[string]simulation.ServiceFunc{ "streamer": func(ctx *adapters.ServiceContext, bucket *sync.Map) (s node.Service, cleanup func(), err error) { var store storage.ChunkStore diff --git a/swarm/network/stream/visualized_snapshot_sync_sim_test.go b/swarm/network/stream/visualized_snapshot_sync_sim_test.go index 96b707797..638eae6e3 100644 --- a/swarm/network/stream/visualized_snapshot_sync_sim_test.go +++ b/swarm/network/stream/visualized_snapshot_sync_sim_test.go @@ -96,7 +96,6 @@ func watchSim(sim *simulation.Simulation) (context.Context, context.CancelFunc) //This test requests bogus hashes into the network func TestNonExistingHashesWithServer(t *testing.T) { - t.Skip("temporarily disabled as simulations.WaitTillHealthy cannot be trusted") nodeCount, _, sim := setupSim(retrievalSimServiceMap) defer sim.Close() @@ -211,6 +210,7 @@ func TestSnapshotSyncWithServer(t *testing.T) { }, }).WithServer(":8888") //start with the HTTP server + nodeCount, chunkCount, sim := setupSim(simServiceMap) defer sim.Close() log.Info("Initializing test config") |