Browse Source

e2e: improve p2p mode selection (#6929)

The previous implemention of hybrid set testing, which was entirely my
own creation, was a bit peculiar, and I think this probably clears thins up.

The previous implementation had far fewer legacy nodes in hybrid
networks, *and* also for some reason that I can't quite explain,
caused a test case to fail.
pull/6900/head
Sam Kleinman 3 years ago
committed by GitHub
parent
commit
3bf0c7a712
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 27 deletions
  1. +20
    -23
      test/e2e/generator/generate.go
  2. +0
    -3
      test/e2e/pkg/manifest.go
  3. +1
    -1
      test/e2e/pkg/testnet.go

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

@ -127,18 +127,11 @@ func generateTestnet(r *rand.Rand, opt map[string]interface{}) (e2e.Manifest, er
TxSize: int64(txSize.Choose(r).(int)),
}
var p2pNodeFactor int
switch opt["p2p"].(P2PMode) {
case NewP2PMode:
manifest.UseLegacyP2P = true
case LegacyP2PMode:
manifest.UseLegacyP2P = false
case HybridP2PMode:
manifest.UseLegacyP2P = true
p2pNodeFactor = 2
p2pMode := opt["p2p"].(P2PMode)
switch p2pMode {
case NewP2PMode, LegacyP2PMode, HybridP2PMode:
default:
return manifest, fmt.Errorf("unknown p2p mode %s", opt["p2p"])
return manifest, fmt.Errorf("unknown p2p mode %s", p2pMode)
}
var numSeeds, numValidators, numFulls, numLightClients int
@ -161,10 +154,11 @@ func generateTestnet(r *rand.Rand, opt map[string]interface{}) (e2e.Manifest, er
for i := 1; i <= numSeeds; i++ {
node := generateNode(r, e2e.ModeSeed, 0, manifest.InitialHeight, false)
if p2pNodeFactor == 0 {
node.UseLegacyP2P = manifest.UseLegacyP2P
} else if p2pNodeFactor%i == 0 {
node.UseLegacyP2P = !manifest.UseLegacyP2P
switch p2pMode {
case LegacyP2PMode:
node.UseLegacyP2P = true
case HybridP2PMode:
node.UseLegacyP2P = r.Intn(2) == 1
}
manifest.Nodes[fmt.Sprintf("seed%02d", i)] = node
@ -185,10 +179,11 @@ func generateTestnet(r *rand.Rand, opt map[string]interface{}) (e2e.Manifest, er
node := generateNode(
r, e2e.ModeValidator, startAt, manifest.InitialHeight, i <= 2)
if p2pNodeFactor == 0 {
node.UseLegacyP2P = manifest.UseLegacyP2P
} else if p2pNodeFactor%i == 0 {
node.UseLegacyP2P = !manifest.UseLegacyP2P
switch p2pMode {
case LegacyP2PMode:
node.UseLegacyP2P = true
case HybridP2PMode:
node.UseLegacyP2P = r.Intn(2) == 1
}
manifest.Nodes[name] = node
@ -221,11 +216,13 @@ func generateTestnet(r *rand.Rand, opt map[string]interface{}) (e2e.Manifest, er
}
node := generateNode(r, e2e.ModeFull, startAt, manifest.InitialHeight, false)
if p2pNodeFactor == 0 {
node.UseLegacyP2P = manifest.UseLegacyP2P
} else if p2pNodeFactor%i == 0 {
node.UseLegacyP2P = !manifest.UseLegacyP2P
switch p2pMode {
case LegacyP2PMode:
node.UseLegacyP2P = true
case HybridP2PMode:
node.UseLegacyP2P = r.Intn(2) == 1
}
manifest.Nodes[fmt.Sprintf("full%02d", i)] = node
}


+ 0
- 3
test/e2e/pkg/manifest.go View File

@ -60,9 +60,6 @@ type Manifest struct {
// by individual nodes.
LogLevel string `toml:"log_level"`
// UseLegacyP2P uses the legacy p2p layer for all nodes in a test.
UseLegacyP2P bool `toml:"use_legacy_p2p"`
// QueueType describes the type of queue that the system uses internally
QueueType string `toml:"queue_type"`


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

@ -182,7 +182,7 @@ func LoadTestnet(file string) (*Testnet, error) {
Perturbations: []Perturbation{},
LogLevel: manifest.LogLevel,
QueueType: manifest.QueueType,
UseLegacyP2P: manifest.UseLegacyP2P && nodeManifest.UseLegacyP2P,
UseLegacyP2P: nodeManifest.UseLegacyP2P,
}
if node.StartAt == testnet.InitialHeight {


Loading…
Cancel
Save