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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -250,16 +250,6 @@ test "serializer: roundtrip app data message" {
|
||||
try testing.expectEqualStrings("custom application payload", full_msg_deserialized.app_data.data);
|
||||
}
|
||||
|
||||
// SEC-M9 FIX: Removed CRC32 checksum test.
|
||||
// CRC32 was redundant with HMAC-SHA256 which provides both integrity AND authentication.
|
||||
// HMAC integrity is tested in the HMAC-specific tests.
|
||||
test "serializer: hmac integrity note" {
|
||||
// This is a placeholder test documenting that integrity checking
|
||||
// is now exclusively handled by HMAC-SHA256, not CRC32.
|
||||
// HMAC provides cryptographic integrity guarantees that CRC32 cannot.
|
||||
try testing.expect(true);
|
||||
}
|
||||
|
||||
test "serializer: corrupted header handling" {
|
||||
const allocator = testing.allocator;
|
||||
var ser = serializer.MessageSerializer.initInsecureForTesting(allocator);
|
||||
|
||||
Reference in New Issue
Block a user