mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 01:13:45 +00:00
pos-845: subtests
This commit is contained in:
parent
043547129a
commit
3e4b872e16
1 changed files with 80 additions and 74 deletions
|
|
@ -148,6 +148,7 @@ func TestValidatorWentOffline(t *testing.T) {
|
|||
func TestForkWithBlockTime(t *testing.T) {
|
||||
|
||||
cases := []struct {
|
||||
name string
|
||||
sprint uint64
|
||||
blockTime map[string]uint64
|
||||
change uint64
|
||||
|
|
@ -155,6 +156,7 @@ func TestForkWithBlockTime(t *testing.T) {
|
|||
forkExpected bool
|
||||
}{
|
||||
{
|
||||
name: "No fork after 2 sprints with producer delay = max block time",
|
||||
sprint: 128,
|
||||
blockTime: map[string]uint64{
|
||||
"0": 5,
|
||||
|
|
@ -166,6 +168,7 @@ func TestForkWithBlockTime(t *testing.T) {
|
|||
forkExpected: false,
|
||||
},
|
||||
{
|
||||
name: "No Fork after 1 sprint producer delay = max block time",
|
||||
sprint: 64,
|
||||
blockTime: map[string]uint64{
|
||||
"0": 5,
|
||||
|
|
@ -176,6 +179,7 @@ func TestForkWithBlockTime(t *testing.T) {
|
|||
forkExpected: false,
|
||||
},
|
||||
{
|
||||
name: "Fork after 4 sprints with producer delay < max block time",
|
||||
sprint: 16,
|
||||
blockTime: map[string]uint64{
|
||||
"0": 2,
|
||||
|
|
@ -191,6 +195,7 @@ func TestForkWithBlockTime(t *testing.T) {
|
|||
genesis := initGenesis(t)
|
||||
|
||||
for _, test := range cases {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
genesis.Config.Bor.Sprint = test.sprint
|
||||
genesis.Config.Bor.Period = test.blockTime
|
||||
genesis.Config.Bor.BackupMultiplier = test.blockTime
|
||||
|
|
@ -210,7 +215,6 @@ func TestForkWithBlockTime(t *testing.T) {
|
|||
t.Fatal("Error occured while starting miner", "node", node, "error", err)
|
||||
}
|
||||
}
|
||||
|
||||
var wg sync.WaitGroup
|
||||
blockHeaders := make([]*types.Header, 2)
|
||||
ticker := time.NewTicker(time.Duration(test.blockTime["0"]) * time.Second)
|
||||
|
|
@ -274,6 +278,8 @@ func TestForkWithBlockTime(t *testing.T) {
|
|||
assert.Equal(t, blockHeaders[0].Time, blockHeaders[1].Time)
|
||||
assert.Equal(t, author2, author3)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue