Merge pull request #10816 from filecoin-project/asr/deflake-ethhistory

feat: deflake TestEthFeeHistory
This commit is contained in:
Aayush Rajasekaran 2023-05-04 13:38:09 -04:00 committed by GitHub
commit 9da534c75c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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))
@ -89,6 +76,16 @@ func TestEthFeeHistory(t *testing.T) {
}
}()
currTs, err := client.ChainHead(ctx)
require.NoError(err)
var tsHeights []int
for currTs.Height() != 0 {
tsHeights = append(tsHeights, int(currTs.Height()))
currTs, err = client.ChainGetTipSet(ctx, currTs.Parents())
require.NoError(err)
}
sort.Ints(tsHeights)
// because of the deferred execution, the last tipset is not executed yet,