Browse Source

e2e: avoid unset defaults in generated tests (#7145)

I've observed a few cases in tests that are probably wrong, and added
some tests to cover this.
pull/7146/head
Sam Kleinman 3 years ago
committed by GitHub
parent
commit
a8917040a8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 8 deletions
  1. +7
    -0
      test/e2e/generator/generate.go
  2. +20
    -8
      test/e2e/generator/generate_test.go

+ 7
- 0
test/e2e/generator/generate.go View File

@ -286,6 +286,13 @@ func generateNode(
Perturb: nodePerturbations.Choose(r),
}
if node.Mempool == "" {
node.Mempool = "v1"
}
if node.PrivvalProtocol == "" {
node.PrivvalProtocol = "file"
}
if startAt > 0 {
node.StateSync = nodeStateSyncs.Choose(r)
if manifest.InitialHeight-startAt <= 5 && node.StateSync == e2e.StateSyncDisabled {


+ 20
- 8
test/e2e/generator/generate_test.go View File

@ -26,15 +26,27 @@ func TestGenerator(t *testing.T) {
numStateSyncs++
}
t.Run(name, func(t *testing.T) {
if node.StartAt > m.InitialHeight+5 && !node.Stateless() {
require.NotEqual(t, node.StateSync, e2e.StateSyncDisabled)
t.Run("StateSync", func(t *testing.T) {
if node.StartAt > m.InitialHeight+5 && !node.Stateless() {
require.NotEqual(t, node.StateSync, e2e.StateSyncDisabled)
}
if node.StateSync != e2e.StateSyncDisabled {
require.Zero(t, node.Seeds, node.StateSync)
require.True(t, len(node.PersistentPeers) >= 2 || len(node.PersistentPeers) == 0,
"peers: %v", node.PersistentPeers)
}
})
if e2e.Mode(node.Mode) != e2e.ModeLight {
t.Run("Mempool", func(t *testing.T) {
require.NotZero(t, node.Mempool)
})
t.Run("PrivvalProtocol", func(t *testing.T) {
require.NotZero(t, node.PrivvalProtocol)
})
t.Run("BlockSync", func(t *testing.T) {
require.NotZero(t, node.BlockSync)
})
}
if node.StateSync != e2e.StateSyncDisabled {
require.Zero(t, node.Seeds, node.StateSync)
require.True(t, len(node.PersistentPeers) >= 2 || len(node.PersistentPeers) == 0,
"peers: %v", node.PersistentPeers)
}
})
}
require.True(t, numStateSyncs <= 2)


Loading…
Cancel
Save