Skip to content

test(kademlia): re-enable TestClosestPeer and TestNotifierHooks - #5686

Merged
acud merged 1 commit into
masterfrom
kademlia-reenable-skipped-tests
Nov 5, 2026
Merged

acud merged 1 commit into
masterfrom
kademlia-reenable-skipped-tests

Conversation

@acud

@acud acud commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Re-enables the two kademlia tests that were skipped with "disabled due to kademlia inconsistencies hotfix". Test-only change.

TestClosestPeer panicked with index out of range [-1] when un-skipped. ClosestPeer only considers self when the node is publicly reachable, and the test never set that, so the want-self case got a peer and a nil error, then evaluated connectedPeers[-1].

  • Set ReachabilityStatusPublic in setup.
  • -1 cases must now return ErrWantSelf, and any error in other cases fails the test instead of being ignored.

TestNotifierHooks needed no changes beyond removing the skip.

Testing

  • TestClosestPeer: 20/20 plain and 50/50 with -race.
  • TestNotifierHooks: 1,000 runs each of plain, -race and -race -cpu 1, all passing.
  • go test -race ./pkg/topology/kademlia/..., go vet and golangci-lint pass on the package.

Note: the original reason for the skips isn't documented (added in 5bacaf5). These tests passing doesn't show that the underlying "inconsistencies" are gone, and they use small static peer sets.

🤖 Generated with Claude Code

TestClosestPeer panicked with index out of range when un-skipped: the
node was never marked publicly reachable, so ClosestPeer did not consider
self and the want-self case fell through to connectedPeers[-1]. Set the
reachability in setup and assert errors explicitly, rather than ignoring
them for cases that expect a peer.

TestNotifierHooks passes unchanged, so only its skip is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@akrem-chabchoub
akrem-chabchoub self-requested a review November 5, 2026 08:35
@acud
acud merged commit 6262a42 into master Nov 5, 2026
18 checks passed
@acud
acud deleted the kademlia-reenable-skipped-tests branch November 5, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants