Skip to content

Commit

Permalink
feat: deflake TestEthFeeHistory
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek committed May 3, 2023
1 parent 093d350 commit e3a674f
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions itests/eth_fee_history_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,6 @@ func TestEthFeeHistory(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()

heads, err := client.ChainNotify(ctx)
require.NoError(err)

// Save the full view of the tipsets to calculate the answer when there are null rounds
tsHeights := []int{1}
go func() {
for chg := range heads {
for _, c := range chg {
tsHeights = append(tsHeights, int(c.Val.Height()))
}
}
}()

miner := ens.InterconnectAll().BeginMining(blockTime)

client.WaitTillChain(ctx, kit.HeightAtLeast(7))
Expand All @@ -89,7 +76,15 @@ func TestEthFeeHistory(t *testing.T) {
}
}()

sort.Ints(tsHeights)
currTs, err := client.ChainHead(ctx)
require.NoError(err)

var tsHeights []int
for currTs.Height() != 0 {
tsHeights = append([]int{int(currTs.Height())}, tsHeights...)
currTs, err = client.ChainGetTipSet(ctx, currTs.Parents())
require.NoError(err)
}

// because of the deferred execution, the last tipset is not executed yet,
// and the one before the last one is the last executed tipset,
Expand Down

0 comments on commit e3a674f

Please sign in to comment.