Skip to content

Add integration tests for NAT peer subscription scenarios #2199

@sanity

Description

@sanity

Problem

The NAT address handling code in subscribe/seeding operations lacks end-to-end integration tests that verify the full flow works correctly with actual NAT scenarios.

Current Test Coverage

  • ✅ Unit tests for LiveTransactionTracker::active_transaction_count
  • ✅ Unit tests for connect operation NAT scenarios
  • ✅ Unit tests for seeding manager subscriber operations
  • ❌ No integration test for subscribe operation NAT address filling
  • ❌ No end-to-end test showing NAT peer successfully subscribing through gateway

Suggested Tests

  1. Subscribe NAT address filling test

    • Peer behind NAT sends subscribe request with PeerAddr::Unknown
    • Gateway fills in observed address from source_addr
    • Verify subscriber is registered with correct address
  2. End-to-end NAT subscription test

    • Set up gateway + NAT peer topology
    • NAT peer subscribes to contract
    • Verify updates are correctly routed back to NAT peer
  3. Edge case: source_addr is None

    • What happens if source_addr is unexpectedly None?
    • Should log warning and handle gracefully

Importance

Medium priority - The code paths are tested via unit tests and manual testing, but automated integration tests would catch regressions and document expected behavior.

Context

[AI-assisted - Claude]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-developer-xpArea: developer experienceA-networkingArea: Networking, ring protocol, peer discoveryE-mediumExperience needed to fix/implement: Medium / intermediateT-enhancementType: Improvement to existing functionality

    Type

    No type

    Projects

    Status

    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions