Skip to content

Commit 9be5adf

Browse files
authored
fix: increase timeout on unit test (#2577)
<!-- Please read and fill out this form before submitting your PR. Please make sure you have reviewed our contributors guide before submitting your first PR. NOTE: PR titles should follow semantic commits: https://www.conventionalcommits.org/en/v1.0.0/ --> ## Overview <!-- Please provide an explanation of the PR, including the appropriate context, background, goal, and rationale. If there is an issue with this information, please provide a tl;dr and link the issue. Ex: Closes #<issue number> --> Increase unit test timeout in order to allow for contexts to properly be cancelled
1 parent a1e56db commit 9be5adf

6 files changed

Lines changed: 50 additions & 15 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ docs/.vitepress/cache
2727
.temp
2828
.vite_opt_cache
2929
.vscode
30+
.claude

node/full_node_integration_test.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,16 @@ func TestTxGossipingMultipleNodesNoDA(t *testing.T) {
3939
// Verify block manager is properly initialized
4040
require.NotNil(nodes[0].blockManager, "Block manager should be initialized")
4141

42+
// Add a small delay to ensure P2P services are fully ready
43+
time.Sleep(500 * time.Millisecond)
44+
4245
// Start the other nodes
4346
for i := 1; i < numNodes; i++ {
4447
startNodeInBackground(t, nodes, ctxs, &runningWg, i)
48+
// Add a small delay between starting nodes to avoid connection race
49+
if i < numNodes-1 {
50+
time.Sleep(100 * time.Millisecond)
51+
}
4552
}
4653

4754
// Inject a transaction into the sequencer's executor
@@ -88,9 +95,16 @@ func TestTxGossipingMultipleNodesDAIncluded(t *testing.T) {
8895
// Verify block manager is properly initialized
8996
require.NotNil(nodes[0].blockManager, "Block manager should be initialized")
9097

98+
// Add a small delay to ensure P2P services are fully ready
99+
time.Sleep(500 * time.Millisecond)
100+
91101
// Start the other nodes
92102
for i := 1; i < numNodes; i++ {
93103
startNodeInBackground(t, nodes, ctxs, &runningWg, i)
104+
// Add a small delay between starting nodes to avoid connection race
105+
if i < numNodes-1 {
106+
time.Sleep(100 * time.Millisecond)
107+
}
94108
}
95109

96110
// Inject a transaction into the sequencer's executor
@@ -142,6 +156,9 @@ func TestFastDASync(t *testing.T) {
142156
blocksToWaitFor := uint64(2)
143157
require.NoError(waitForAtLeastNDAIncludedHeight(nodes[0], blocksToWaitFor))
144158

159+
// Add a small delay to ensure P2P services are fully ready
160+
time.Sleep(500 * time.Millisecond)
161+
145162
// Now start the second node and time its sync
146163
startNodeInBackground(t, nodes, ctxs, &runningWg, 1)
147164
start := time.Now()
@@ -186,9 +203,16 @@ func TestSingleSequencerTwoFullNodesBlockSyncSpeed(t *testing.T) {
186203
// Wait for the sequencer to produce at first block
187204
require.NoError(waitForFirstBlock(nodes[0], Store))
188205

206+
// Add a small delay to ensure P2P services are fully ready
207+
time.Sleep(500 * time.Millisecond)
208+
189209
// Now start the other nodes
190210
for i := 1; i < numNodes; i++ {
191211
startNodeInBackground(t, nodes, ctxs, &runningWg, i)
212+
// Add a small delay between starting nodes to avoid connection race
213+
if i < numNodes-1 {
214+
time.Sleep(100 * time.Millisecond)
215+
}
192216
}
193217

194218
blocksToWaitFor := uint64(10)
@@ -274,6 +298,9 @@ func testSingleSequencerSingleFullNode(t *testing.T, source Source) {
274298
// Wait for the sequencer to produce at first block
275299
require.NoError(waitForFirstBlock(nodes[0], source))
276300

301+
// Add a small delay to ensure P2P services are fully ready
302+
time.Sleep(500 * time.Millisecond)
303+
277304
// Start the full node
278305
startNodeInBackground(t, nodes, ctxs, &runningWg, 1)
279306

@@ -312,9 +339,16 @@ func testSingleSequencerTwoFullNodes(t *testing.T, source Source) {
312339
// Wait for the sequencer to produce at first block
313340
require.NoError(waitForFirstBlock(nodes[0], source))
314341

342+
// Add a small delay to ensure P2P services are fully ready
343+
time.Sleep(500 * time.Millisecond)
344+
315345
// Start the full nodes
316346
for i := 1; i < numNodes; i++ {
317347
startNodeInBackground(t, nodes, ctxs, &runningWg, i)
348+
// Add a small delay between starting nodes to avoid connection race
349+
if i < numNodes-1 {
350+
time.Sleep(100 * time.Millisecond)
351+
}
318352
}
319353

320354
blocksToWaitFor := uint64(3)
@@ -372,6 +406,9 @@ func testSingleSequencerSingleFullNodeTrustedHash(t *testing.T, source Source) {
372406
// Set the trusted hash in the full node
373407
nodes[1].nodeConfig.Node.TrustedHash = trustedHash
374408

409+
// Add a small delay to ensure P2P services are fully ready
410+
time.Sleep(500 * time.Millisecond)
411+
375412
// Start the full node
376413
startNodeInBackground(t, nodes, ctxs, &runningWg, 1)
377414

node/single_sequencer_integration_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func (s *FullNodeTestSuite) TearDownTest() {
109109
select {
110110
case <-waitCh:
111111
// Node stopped successfully
112-
case <-time.After(5 * time.Second):
112+
case <-time.After(10 * time.Second):
113113
s.T().Log("Warning: Node did not stop gracefully within timeout")
114114
}
115115

@@ -243,7 +243,7 @@ func TestStateRecovery(t *testing.T) {
243243
select {
244244
case <-waitCh:
245245
// Node stopped successfully
246-
case <-time.After(2 * time.Second):
246+
case <-time.After(30 * time.Second):
247247
t.Fatalf("Node did not stop gracefully within timeout")
248248
}
249249

@@ -288,7 +288,7 @@ func TestMaxPendingHeadersAndData(t *testing.T) {
288288
require.LessOrEqual(height, config.Node.MaxPendingHeadersAndData)
289289

290290
// Stop the node and wait for shutdown
291-
shutdownAndWait(t, []context.CancelFunc{cancel}, &runningWg, 5*time.Second)
291+
shutdownAndWait(t, []context.CancelFunc{cancel}, &runningWg, 10*time.Second)
292292
}
293293

294294
// TestBatchQueueThrottlingWithDAFailure tests that when DA layer fails and MaxPendingHeadersAndData
@@ -400,5 +400,5 @@ func TestBatchQueueThrottlingWithDAFailure(t *testing.T) {
400400
t.Log("the batch queue would fill up and return ErrQueueFull, providing backpressure.")
401401

402402
// Shutdown
403-
shutdownAndWait(t, []context.CancelFunc{cancel}, &runningWg, 5*time.Second)
403+
shutdownAndWait(t, []context.CancelFunc{cancel}, &runningWg, 10*time.Second)
404404
}

node/single_sequencer_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func TestStartup(t *testing.T) {
2626
}()
2727

2828
// Allow some time for the node to start
29-
time.Sleep(100 * time.Millisecond)
29+
time.Sleep(500 * time.Millisecond)
3030

3131
// Node should be running (no error received yet)
3232
select {
@@ -44,7 +44,7 @@ func TestStartup(t *testing.T) {
4444
case err := <-errChan:
4545
// Context cancellation should result in context.Canceled error
4646
require.ErrorIs(t, err, context.Canceled)
47-
case <-time.After(500 * time.Millisecond):
47+
case <-time.After(2 * time.Second):
4848
t.Fatal("Node did not stop after context cancellation")
4949
}
5050

test/docker-e2e/go.mod

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ require github.com/celestiaorg/tastora v0.2.2
77
require (
88
cosmossdk.io/x/upgrade v0.1.4 // indirect
99
github.com/chzyer/readline v1.5.1 // indirect
10-
github.com/containerd/errdefs/pkg v0.3.0 // indirect
1110
github.com/cosmos/ibc-go/modules/capability v1.0.1 // indirect
1211
github.com/cosmos/ibc-go/v8 v8.7.0 // indirect
1312
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
@@ -96,7 +95,7 @@ require (
9695
github.com/dgraph-io/badger/v4 v4.2.0 // indirect
9796
github.com/dgraph-io/ristretto v0.1.1 // indirect
9897
github.com/distribution/reference v0.6.0 // indirect
99-
github.com/docker/docker v28.3.3+incompatible // indirect
98+
github.com/docker/docker v28.2.2+incompatible // indirect
10099
github.com/docker/go-connections v0.5.0 // indirect
101100
github.com/docker/go-units v0.5.0 // indirect
102101
github.com/dustin/go-humanize v1.0.1 // indirect
@@ -148,7 +147,7 @@ require (
148147
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
149148
github.com/mitchellh/mapstructure v1.5.0 // indirect
150149
github.com/moby/docker-image-spec v1.3.1 // indirect
151-
github.com/moby/moby v28.3.3+incompatible
150+
github.com/moby/moby v27.5.1+incompatible
152151
github.com/moby/sys/sequential v0.6.0 // indirect
153152
github.com/mtibben/percent v0.2.1 // indirect
154153
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect

test/docker-e2e/go.sum

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,6 @@ github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvA
219219
github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM=
220220
github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG8PI=
221221
github.com/containerd/errdefs v1.0.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M=
222-
github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151Xdx3ZPPE=
223-
github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk=
224222
github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I=
225223
github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo=
226224
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
@@ -276,8 +274,8 @@ github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WA
276274
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
277275
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
278276
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
279-
github.com/docker/docker v28.3.3+incompatible h1:Dypm25kh4rmk49v1eiVbsAtpAsYURjYkaKubwuBdxEI=
280-
github.com/docker/docker v28.3.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
277+
github.com/docker/docker v28.2.2+incompatible h1:CjwRSksz8Yo4+RmQ339Dp/D2tGO5JxwYeqtMOEe0LDw=
278+
github.com/docker/docker v28.2.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
281279
github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c=
282280
github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc=
283281
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
@@ -633,8 +631,8 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua
633631
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
634632
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
635633
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
636-
github.com/moby/moby v28.3.3+incompatible h1:nzkZIIn9bQP9S553kNmJ+U8PBhdS2ciFWphV2vX/Zp4=
637-
github.com/moby/moby v28.3.3+incompatible/go.mod h1:fDXVQ6+S340veQPv35CzDahGBmHsiclFwfEygB/TWMc=
634+
github.com/moby/moby v27.5.1+incompatible h1:/pN59F/t3U7Q4FPzV88nzqf7Fp0qqCSL2KzhZaiKcKw=
635+
github.com/moby/moby v27.5.1+incompatible/go.mod h1:fDXVQ6+S340veQPv35CzDahGBmHsiclFwfEygB/TWMc=
638636
github.com/moby/sys/atomicwriter v0.1.0 h1:kw5D/EqkBwsBFi0ss9v1VG3wIkVhzGvLklJ+w3A14Sw=
639637
github.com/moby/sys/atomicwriter v0.1.0/go.mod h1:Ul8oqv2ZMNHOceF643P6FKPXeCmYtlQMvpizfsSoaWs=
640638
github.com/moby/sys/sequential v0.6.0 h1:qrx7XFUd/5DxtqcoH1h438hF5TmOvzC/lspjy7zgvCU=

0 commit comments

Comments
 (0)