Skip to content

Commit

Permalink
fix(tests): fix FraudProofHandling test
Browse files Browse the repository at this point in the history
  • Loading branch information
vgonkivs committed Sep 28, 2023
1 parent 849cb67 commit 40beba5
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions nodebuilder/tests/fraud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,23 @@ func TestFraudProofHandling(t *testing.T) {
// FIXME: Eventually, this should be a check on service registry managing and keeping
// lifecycles of each Module.
// 6.
syncCtx, syncCancel := context.WithTimeout(context.Background(), blockTime*5)
_, err = fullClient.Header.WaitForHeight(syncCtx, 15)
require.ErrorIs(t, err, context.DeadlineExceeded)
syncCancel()
attempts := 0
timeOut := blockTime * 5
height := uint64(15)
for attempts < 5 {
syncCtx, syncCancel := context.WithTimeout(context.Background(), timeOut)
_, err = full.HeaderServ.WaitForHeight(syncCtx, height)
syncCancel()
if err != nil {
break
}
attempts++
timeOut = blockTime
height++
}

require.NotNil(t, err)
require.ErrorIs(t, err, context.DeadlineExceeded)
// 7.
cfg = nodebuilder.DefaultConfig(node.Light)
cfg.Header.TrustedPeers = append(cfg.Header.TrustedPeers, addrs[0].String())
Expand Down

0 comments on commit 40beba5

Please sign in to comment.