fix(tests): add relay-only peer nwaku so mesh forms before tests publish#2782
Closed
Ivansete-status wants to merge 1 commit into
Closed
fix(tests): add relay-only peer nwaku so mesh forms before tests publish#2782Ivansete-status wants to merge 1 commit into
Ivansete-status wants to merge 1 commit into
Conversation
Tests built on `runNodes` (Store, Filter single-node, etc.) start a single
nwaku container and a js-waku LightNode. LightNodes never join the
gossipsub mesh, so the nwaku ends up with zero mesh peers on the test
topic. After nwaku PR #3669 (Jan 2026) the REST endpoint
`POST /relay/v1/auto/messages` now returns HTTP 400 with
`NoPeersToPublish` instead of silently succeeding in that state, which
causes `ServiceNode.sendMessage()` to return `false` and fails every
test that seeds the store via REST publish. That broke ~50/56 of the
failing assertions in the nwaku `js-waku-node` CI job and the job has
been red on every master run since.
Fix the test harness rather than reverting the (correct) nwaku change:
- `runNodes` now starts a second relay-only `ServiceNode` chained to the
primary via `--staticnode`, subscribed to the same shards/topics. Once
the gossipsub mesh GRAFTs, REST publishes on the primary have a real
mesh peer and succeed.
- The peer's lifecycle is bound to the primary through a new private
`companion` field + `setCompanion()` getter; existing `tearDownNodes`
calls keep working unchanged.
- Add `ServiceNode.waitForMeshPeers(pubsubTopics, {timeoutMs})` polling
`/admin/v1/peers/mesh`, called before `runNodes` returns so the first
publish doesn't race the heartbeat.
Doesn't touch `ServiceNodesFleet` (already multi-node); doesn't address
the Filter Multiple-Service-Nodes duplication or Peer Exchange compliance
timeouts surfaced in the same run — those are separate bugs.
size-limit report 📦
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tests built on
runNodes(Store, Filter single-node, etc.) spawn one nwaku container + one js-wakuLightNode. Light nodes never join the gossipsub mesh, so the nwaku has zero mesh peers on the test topic. Since nwaku PR #3669 (Jan 2026) the REST endpointPOST /relay/v1/auto/messagesreturns HTTP 400 /NoPeersToPublishin that state instead of silently succeeding, soServiceNode.sendMessage()returnsfalseand every test that seeds the store via REST publish fails.That regression broke ~50 / 56 of the failing assertions on the nwaku
js-waku-nodeCI job; the job has been red on every nwaku master run since (see nwaku run 26212476786 for the most recent example).This PR fixes the harness rather than reverting the (correct) nwaku change.
What changed
runNodesnow starts a second relay-onlyServiceNodechained to the primary via--staticnode, subscribed to the same shards/topics. Once the gossipsub mesh GRAFTs, REST publishes on the primary have a real mesh peer and succeed.companionfield +setCompanion()setter; existingtearDownNodes(nwaku, ...)calls cascade and stop both nodes — no test changes needed.ServiceNode.waitForMeshPeers(pubsubTopics, {timeoutMs})polling/admin/v1/peers/mesh, called beforerunNodesreturns so the first publish doesn't race the gossipsub heartbeat.Out of scope
ServiceNodesFleettests (already multi-node) — untouched.Test plan
npm run check --workspace=@waku/tests✅npm run build:esmpasses across all workspaces ✅test:nodejob green againstquay.io/wakuorg/nwaku-pr:<latest>— needs CI🤖 Generated with Claude Code