Skip to content

Commit

Permalink
chore: reduce lieklyhood of flakes and be explicit about a flake failure
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-forbes committed Oct 16, 2024
1 parent b9b1df8 commit 8c019af
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions test/e2e/major_upgrade_v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func MajorUpgradeToV3(logger *log.Logger) error {

timer := time.NewTimer(20 * time.Minute)
defer timer.Stop()
ticker := time.NewTicker(10 * time.Second)
ticker := time.NewTicker(3 * time.Second)
defer ticker.Stop()

logger.Println("waiting for upgrade")
Expand Down Expand Up @@ -113,13 +113,21 @@ func MajorUpgradeToV3(logger *log.Logger) error {
rpcNode := testNet.Nodes()[0]
client, err := rpcNode.Client()
testnet.NoError("failed to get client", err)
blockTimes := make([]time.Duration, 0, 7)

startHeight := upgradeHeightV3 - 5
endHeight := upgradedHeight + 1
blockTimes := make([]time.Duration, 0, endHeight-startHeight)
var prevBlockTime time.Time
for h := upgradeHeightV3 - 4; h <= upgradeHeightV3+4; h++ {

for h := startHeight; h < endHeight; h++ {
resp, err := client.Header(ctx, &h)
testnet.NoError("failed to get header", err)
blockTime := resp.Header.Time
if prevBlockTime.IsZero() {

if h == startHeight {
if resp.Header.Version.App != v2.Version {
return fmt.Errorf("start height %v was app version 2, this is a flake and the start height needs to be reduced", startHeight)
}
prevBlockTime = blockTime
continue
}
Expand All @@ -129,10 +137,6 @@ func MajorUpgradeToV3(logger *log.Logger) error {
blockTimes = append(blockTimes, blockDur)
}

if len(blockTimes) < 7 {
testnet.NoError("", fmt.Errorf("not enough block times collected: %v", len(blockTimes)))
}

startDur := blockTimes[0]
endDur := blockTimes[len(blockTimes)-1]

Expand Down

0 comments on commit 8c019af

Please sign in to comment.