Browse Source

e2e: improve network connectivity (#7077)

This tweaks the connectivity of test configurations, in hopes that more will be viable.

Additionally reduces the prevalence of testing the legacy mempool.
pull/7088/head
Sam Kleinman 3 years ago
committed by GitHub
parent
commit
1f438f205a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 23 deletions
  1. +14
    -20
      test/e2e/generator/generate.go
  2. +2
    -2
      test/e2e/generator/generate_test.go
  3. +1
    -1
      test/e2e/pkg/testnet.go

+ 14
- 20
test/e2e/generator/generate.go View File

@ -44,9 +44,10 @@ var (
"tcp": 20, "tcp": 20,
"unix": 10, "unix": 10,
} }
// FIXME: v2 disabled due to flake
nodeBlockSyncs = uniformChoice{"v0"} // "v2"
nodeMempools = uniformChoice{"v0", "v1"}
nodeMempools = weightedChoice{
"v0": 20,
"v1": 80,
}
nodeStateSyncs = weightedChoice{ nodeStateSyncs = weightedChoice{
e2e.StateSyncDisabled: 10, e2e.StateSyncDisabled: 10,
e2e.StateSyncP2P: 45, e2e.StateSyncP2P: 45,
@ -54,8 +55,12 @@ var (
} }
nodePersistIntervals = uniformChoice{0, 1, 5} nodePersistIntervals = uniformChoice{0, 1, 5}
nodeSnapshotIntervals = uniformChoice{0, 5} nodeSnapshotIntervals = uniformChoice{0, 5}
nodeRetainBlocks = uniformChoice{0, 2 * int(e2e.EvidenceAgeHeight), 4 * int(e2e.EvidenceAgeHeight)}
nodePerturbations = probSetChoice{
nodeRetainBlocks = uniformChoice{
0,
2 * int(e2e.EvidenceAgeHeight),
4 * int(e2e.EvidenceAgeHeight),
}
nodePerturbations = probSetChoice{
"disconnect": 0.1, "disconnect": 0.1,
"pause": 0.1, "pause": 0.1,
"kill": 0.1, "kill": 0.1,
@ -236,13 +241,9 @@ func generateTestnet(r *rand.Rand, opt map[string]interface{}) (e2e.Manifest, er
// choose one of the seeds // choose one of the seeds
manifest.Nodes[name].Seeds = uniformSetChoice(seedNames).Choose(r) manifest.Nodes[name].Seeds = uniformSetChoice(seedNames).Choose(r)
} else if i > 0 {
} else if i > 1 && r.Float64() >= 0.5 {
peers := uniformSetChoice(peerNames[:i]) peers := uniformSetChoice(peerNames[:i])
if manifest.Nodes[name].StateSync == e2e.StateSyncP2P {
manifest.Nodes[name].PersistentPeers = peers.ChooseAtLeast(r, 2)
} else {
manifest.Nodes[name].PersistentPeers = peers.Choose(r)
}
manifest.Nodes[name].PersistentPeers = peers.ChooseAtLeast(r, 2)
} }
} }
@ -250,9 +251,7 @@ func generateTestnet(r *rand.Rand, opt map[string]interface{}) (e2e.Manifest, er
for i := 1; i <= numLightClients; i++ { for i := 1; i <= numLightClients; i++ {
startAt := manifest.InitialHeight + 5 startAt := manifest.InitialHeight + 5
node := generateLightNode(
r, startAt+(5*int64(i)), lightProviders,
)
node := generateLightNode(r, startAt+(5*int64(i)), lightProviders)
manifest.Nodes[fmt.Sprintf("light%02d", i)] = node manifest.Nodes[fmt.Sprintf("light%02d", i)] = node
@ -278,8 +277,7 @@ func generateNode(
Database: nodeDatabases.Choose(r), Database: nodeDatabases.Choose(r),
ABCIProtocol: nodeABCIProtocols.Choose(r), ABCIProtocol: nodeABCIProtocols.Choose(r),
PrivvalProtocol: nodePrivvalProtocols.Choose(r), PrivvalProtocol: nodePrivvalProtocols.Choose(r),
BlockSync: nodeBlockSyncs.Choose(r).(string),
Mempool: nodeMempools.Choose(r).(string),
Mempool: nodeMempools.Choose(r),
StateSync: e2e.StateSyncDisabled, StateSync: e2e.StateSyncDisabled,
PersistInterval: ptrUint64(uint64(nodePersistIntervals.Choose(r).(int))), PersistInterval: ptrUint64(uint64(nodePersistIntervals.Choose(r).(int))),
SnapshotInterval: uint64(nodeSnapshotIntervals.Choose(r).(int)), SnapshotInterval: uint64(nodeSnapshotIntervals.Choose(r).(int)),
@ -326,10 +324,6 @@ func generateNode(
} }
} }
if node.StateSync != e2e.StateSyncDisabled {
node.BlockSync = "v0"
}
return &node return &node
} }


+ 2
- 2
test/e2e/generator/generate_test.go View File

@ -31,8 +31,8 @@ func TestGenerator(t *testing.T) {
} }
if node.StateSync != e2e.StateSyncDisabled { if node.StateSync != e2e.StateSyncDisabled {
require.Zero(t, node.Seeds, node.StateSync) require.Zero(t, node.Seeds, node.StateSync)
require.True(t, len(node.PersistentPeers) >= 2)
require.Equal(t, "v0", node.BlockSync)
require.True(t, len(node.PersistentPeers) >= 2 || len(node.PersistentPeers) == 0,
"peers: %v", node.PersistentPeers)
} }
}) })


+ 1
- 1
test/e2e/pkg/testnet.go View File

@ -172,7 +172,7 @@ func LoadTestnet(file string) (*Testnet, error) {
ABCIProtocol: ProtocolBuiltin, ABCIProtocol: ProtocolBuiltin,
PrivvalProtocol: ProtocolFile, PrivvalProtocol: ProtocolFile,
StartAt: nodeManifest.StartAt, StartAt: nodeManifest.StartAt,
BlockSync: nodeManifest.BlockSync,
BlockSync: "v0",
Mempool: nodeManifest.Mempool, Mempool: nodeManifest.Mempool,
StateSync: nodeManifest.StateSync, StateSync: nodeManifest.StateSync,
PersistInterval: 1, PersistInterval: 1,


Loading…
Cancel
Save