Skip to content

Commit 4cc87d6

Browse files
rootulpclaude
andcommitted
fix(nodebuilder/tests): fix pruning and shrex test failures
TestArchivalBlobSync: the prunerOpts only replaced time.Duration, but the pruner service uses share.Window for its availability window. Add fx.Replace(modshare.Window(testAvailWindow)) for pruning nodes so the pruner actually uses the 1ms window to prune historical data. TestShrexFromLightsWithBadFulls: setTimeInterval was using testTimeout (10min) as the AdvertiseInterval, preventing peer discovery for the entire test duration. Use a fixed 20s interval instead. TestHeaderSubscription: revert changes since the test already used DefaultTestTimeout and the gossipsub issue with FanoutOnly in mocknet is a pre-existing problem requiring deeper fixes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2149ac3 commit 4cc87d6

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

nodebuilder/tests/api_test.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -156,18 +156,7 @@ func TestHeaderSubscription(t *testing.T) {
156156
err = light.Start(ctx)
157157
require.NoError(t, err)
158158

159-
// Explicitly connect bridge and light, then wait for gossipsub mesh
160-
// formation. Bridge nodes use FanoutOnly for header gossipsub, so we
161-
// need to ensure the connection is established and gossipsub has
162-
// exchanged subscription metadata before subscribing.
163-
sw.Connect(t, bridge, light)
164-
165159
lightClient := getAdminClient(ctx, light, t)
166-
// Wait for the light to sync a few headers (proves connectivity) and
167-
// give gossipsub heartbeats time to propagate subscription info.
168-
_, err = lightClient.Header.WaitForHeight(ctx, 3)
169-
require.NoError(t, err)
170-
time.Sleep(3 * time.Second)
171160

172161
// subscribe to headers via the light node's RPC header subscription
173162
subctx, subcancel := context.WithCancel(ctx)

nodebuilder/tests/prune_test.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"github.com/celestiaorg/celestia-node/nodebuilder"
2121
"github.com/celestiaorg/celestia-node/nodebuilder/node"
2222
"github.com/celestiaorg/celestia-node/nodebuilder/pruner"
23+
modshare "github.com/celestiaorg/celestia-node/nodebuilder/share"
2324
"github.com/celestiaorg/celestia-node/nodebuilder/tests/swamp"
2425
"github.com/celestiaorg/celestia-node/share"
2526
full_avail "github.com/celestiaorg/celestia-node/share/availability/full"
@@ -88,6 +89,13 @@ func TestArchivalBlobSync(t *testing.T) {
8889
)
8990
}),
9091
)
92+
// pruningNodeOpts also replaces the share.Window so the pruner service
93+
// uses the 1ms availability window (prunerOpts only replaces time.Duration
94+
// which doesn't affect the pruner's share.Window-typed dependency).
95+
pruningNodeOpts := fx.Options(
96+
prunerOpts,
97+
fx.Replace(modshare.Window(testAvailWindow)),
98+
)
9199

92100
// wait until bn syncs to the latest submitted height
93101
_, err = archivalFN.HeaderServ.WaitForHeight(ctx, heights[len(heights)-1])
@@ -101,14 +109,14 @@ func TestArchivalBlobSync(t *testing.T) {
101109
sw.Bootstrappers = sw.Bootstrappers[:0]
102110
sw.SetBootstrapper(t, archivalFN)
103111

104-
pruningBN := sw.NewBridgeNode(prunerOpts)
112+
pruningBN := sw.NewBridgeNode(pruningNodeOpts)
105113
err = pruningBN.Start(ctx)
106114
require.NoError(t, err)
107115

108116
pruningFulls := make([]*nodebuilder.Node, 0, 3)
109117
for range 3 {
110118
cfg := sw.DefaultTestConfig(node.Bridge)
111-
pruningFN := sw.NewNodeWithConfig(node.Bridge, cfg, prunerOpts)
119+
pruningFN := sw.NewNodeWithConfig(node.Bridge, cfg, pruningNodeOpts)
112120
err = pruningFN.Start(ctx)
113121
require.NoError(t, err)
114122

nodebuilder/tests/shrex_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func TestShrexFromLightsWithBadFulls(t *testing.T) {
123123
fulls := make([]*nodebuilder.Node, 0, amountOfFulls)
124124
for i := 0; i < amountOfFulls; i++ {
125125
cfg := sw.DefaultTestConfig(node.Bridge)
126-
setTimeInterval(cfg, testTimeout)
126+
setTimeInterval(cfg, time.Second*20)
127127
full := sw.NewNodeWithConfig(node.Bridge, cfg, replaceShrexServer(cfg, ndHandler), replaceShareGetter())
128128
fulls = append(fulls, full)
129129
}

0 commit comments

Comments
 (0)