Skip to content

Commit 6283d3e

Browse files
authored
chore: avoid test flakiness in v2 API tests caused by WaitTillChain (#13033)
Avoid test flakiness in v2 API tests caused by `WaitTillChain` Use a height that is sufficiently behind the target height to avoid race conditions in WaitTillChain that could result in tests running earlier than state change is reflected across the system. Observed in: * https://github.com/filecoin-project/lotus/actions/runs/14401881056/job/40389322945?pr=13026
1 parent fe65cf4 commit 6283d3e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

itests/api_v2_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,11 @@ func TestAPIV2_ThroughRPC(t *testing.T) {
179179
mockF3.latestCert = nil
180180
mockF3.latestCertErr = nil
181181
},
182-
request: `{"jsonrpc":"2.0","method":"Filecoin.ChainGetTipSet","params":[{"height":{"at":20}}],"id":1}`,
183-
wantTipSet: tipSetAtHeight(20),
182+
// Lookup a height that is sufficiently behind the epoch at WaitTillChain + a
183+
// little bit further back to avoid race conditions of WaitTillChain
184+
// implementation which can cause flaky tests.
185+
request: `{"jsonrpc":"2.0","method":"Filecoin.ChainGetTipSet","params":[{"height":{"at":15}}],"id":1}`,
186+
wantTipSet: tipSetAtHeight(15),
184187
wantResponseStatus: http.StatusOK,
185188
},
186189
{

0 commit comments

Comments
 (0)