clean up tests. remove placeholder assert-true tests, fix replay

protection and NAT test logic, fix MWP connection test peer ID
registration, use atomic port counter for test parallelism
This commit is contained in:
2026-02-10 20:13:54 -03:00
parent a44af22739
commit b7d013a272
12 changed files with 19 additions and 169 deletions

View File

@@ -50,14 +50,17 @@ test "MWP: two P2P nodes complete hole punch on localhost" {
};
// Register Bob's DHT ID on Alice's side (so Alice can route DHT messages to Bob)
const server_peer_id = pair.getPeerId().?;
// Get Bob's view of Alice's peer ID from the server's perspective
// The server sees the client as server_peer_id, and the client sees the server as its connected peer
pair.server.registerDhtNodeId(bob_dht_id, server_peer_id) catch {};
// getPeerId() returns the client's view of the server — correct for Bob's side
// getServerSidePeerId() returns the server's view of the client — correct for Alice's side
const client_view_of_server = pair.getPeerId().?;
const server_view_of_client = pair.getServerSidePeerId() orelse {
std.debug.print("Server has no connected peer\n", .{});
return error.SkipZigTest;
};
pair.server.registerDhtNodeId(bob_dht_id, server_view_of_client) catch {};
// Register Alice's DHT ID on Bob's side
// The client's connected peer is the server
pair.client.registerDhtNodeId(alice_dht_id, server_peer_id) catch {};
pair.client.registerDhtNodeId(alice_dht_id, client_view_of_server) catch {};
// Add to DHT routing tables
var alice_addr = Address.init();