Skip to content

chore(service-disco): add component tests - #2308

Merged
gmelodie merged 109 commits into
masterfrom
feat/service-disco/integration-tests
Apr 22, 2026
Merged

gmelodie merged 109 commits into
masterfrom
feat/service-disco/integration-tests

Conversation

@gmelodie

Copy link
Copy Markdown
Collaborator

Summary

Adds an integration test suite that exercises the full service-discovery protocol across real networked
nodes — register, get-ads, and end-to-end advertise→discover — using the advertiser, registrar, and
discoverer components built in prior branches.

  • tests/libp2p/service_discovery/test_integration.nim (new):
    • processRetryTicket — unit tests (no I/O) covering all ticket-validation edge cases: no ticket,
      mismatched bytes, bad signature, expired/before/after-window, within-window, and sufficient-elapsed-time
      scenarios.
    • Integration - handleRegister — networked tests: first register → Wait, wrong-key ticket → Rejected,
      out-of-window ticket → Rejected, safetyParam=0 → Confirmed on first attempt.
    • Integration - handleGetAds — networked tests: empty cache returns no ads, stored ads are returned
      correctly, fReturn cap is respected.
    • Integration - end-to-end — addProvidedService triggers background registration; lookup on a separate
      node finds the advertisement.

Affected Areas

  • Gossipsub
  • Transports
  • Peer Management / Discovery
  • Protocol Logic
  • Build / Tooling
  • Other
    Test-only change: new integration suite, no library code modified.

Compatibility & Downstream Validation

No library code changed. No API, ABI, or wire-format impact. Downstream consumers are unaffected.


Impact on Library Users

None — this PR adds tests only.


Risk Assessment

  • Test flakiness — low risk. checkUntilTimeout guards the async synchronisation point in the end-to-end
    test; no fixed sleeps.

References

gmelodie and others added 30 commits April 15, 2026 15:44
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@gmelodie
gmelodie force-pushed the feat/service-disco/integration-tests branch from 484e1a8 to d8ec4f9 Compare April 21, 2026 14:55
gmelodie and others added 6 commits April 21, 2026 11:55
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Base automatically changed from feat/service-disco/discoverer-tests to master April 21, 2026 17:54
@gmelodie
gmelodie requested a review from a team April 21, 2026 17:54
@gmelodie
gmelodie enabled auto-merge (squash) April 22, 2026 01:21
gmelodie and others added 2 commits April 21, 2026 22:30
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@gmelodie gmelodie changed the title chore(service-disco): add integration tests chore(service-disco): add component tests Apr 22, 2026
@github-project-automation github-project-automation Bot moved this from new to In Progress in nim-libp2p Apr 22, 2026
@gmelodie
gmelodie merged commit 30a05fe into master Apr 22, 2026
24 checks passed
@gmelodie
gmelodie deleted the feat/service-disco/integration-tests branch April 22, 2026 15:26
@github-project-automation github-project-automation Bot moved this from In Progress to done in nim-libp2p Apr 22, 2026
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.

5 participants