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

@@ -426,8 +426,12 @@ test "ReplayProtector: same message ID different peers" {
// Peer A sends message ID 42
try protector.checkMessage(42, current_time, 15000, 1, peer_a);
// Peer B tries same message ID - should fail (message IDs are global)
const result = protector.checkMessage(42, current_time + 1, 15001, 1, peer_b);
// Peer B sends same message ID — allowed because replay protection is per-peer.
// Each peer chooses IDs independently, so collisions between peers are expected.
try protector.checkMessage(42, current_time + 1, 15001, 1, peer_b);
// But Peer A replaying its own message ID should still be rejected
const result = protector.checkMessage(42, current_time + 2, 15002, 2, peer_a);
try testing.expectError(ReplayError.DuplicateMessageId, result);
}