mirror of
https://github.com/tendermint/tendermint.git
synced 2026-02-11 06:11:07 +00:00
This tweaks the connectivity of test configurations, in hopes that more will be viable. Additionally reduces the prevalence of testing the legacy mempool.
44 lines
1.2 KiB
Go
44 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"math/rand"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
e2e "github.com/tendermint/tendermint/test/e2e/pkg"
|
|
)
|
|
|
|
func TestGenerator(t *testing.T) {
|
|
manifests, err := Generate(rand.New(rand.NewSource(randomSeed)), Options{})
|
|
require.NoError(t, err)
|
|
require.True(t, len(manifests) >= 24, "insufficient combinations %d", len(manifests))
|
|
|
|
// this just means that the numbers reported by the test
|
|
// failures map to the test cases that you'd see locally.
|
|
e2e.SortManifests(manifests, false /* ascending */)
|
|
|
|
for idx, m := range manifests {
|
|
t.Run(fmt.Sprintf("Case%04d", idx), func(t *testing.T) {
|
|
numStateSyncs := 0
|
|
for name, node := range m.Nodes {
|
|
if node.StateSync != e2e.StateSyncDisabled {
|
|
numStateSyncs++
|
|
}
|
|
t.Run(name, 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)
|
|
}
|
|
|
|
})
|
|
}
|
|
require.True(t, numStateSyncs <= 2)
|
|
})
|
|
}
|
|
}
|