fix protocol+tests: replay protection rework, wire envelope nonce auth,
flaky e2e test deadlines, build imports
This commit is contained in:
@@ -30,14 +30,17 @@ test "end-to-end file transfer" {
|
||||
defer std.fs.cwd().deleteFile(dest_path) catch {};
|
||||
|
||||
// Create two P2P instances - peer A (port 0 = random) and peer B
|
||||
// Noise disabled: this test exercises file transfer, not encryption
|
||||
var config_a = p2p.P2PConfig.default();
|
||||
config_a.network.listen_port = 19301; // Fixed port for peer A
|
||||
config_a.network.enable_noise_encryption = false;
|
||||
config_a.file_sharing.piece_size = 256;
|
||||
config_a.file_sharing.allowed_share_directories = &[_][]const u8{"tests/test_data"};
|
||||
config_a.library.shutdown_timeout_ms = 500; // Fast shutdown for tests
|
||||
|
||||
var config_b = p2p.P2PConfig.default();
|
||||
config_b.network.listen_port = 19302; // Fixed port for peer B
|
||||
config_b.network.enable_noise_encryption = false;
|
||||
config_b.file_sharing.piece_size = 256;
|
||||
config_b.file_sharing.allowed_share_directories = &[_][]const u8{"tests/test_data"};
|
||||
config_b.library.shutdown_timeout_ms = 500; // Fast shutdown for tests
|
||||
@@ -172,15 +175,17 @@ test "e2e file transfer: binary file with pattern" {
|
||||
defer std.fs.cwd().deleteFile(source_path) catch {};
|
||||
defer std.fs.cwd().deleteFile(dest_path) catch {};
|
||||
|
||||
// Create two P2P instances
|
||||
// Create two P2P instances (Noise disabled — testing file transfer, not encryption)
|
||||
var config_a = p2p.P2PConfig.default();
|
||||
config_a.network.listen_port = 19311;
|
||||
config_a.network.enable_noise_encryption = false;
|
||||
config_a.file_sharing.piece_size = 512; // Multiple pieces
|
||||
config_a.file_sharing.allowed_share_directories = &[_][]const u8{"tests/test_data"};
|
||||
config_a.library.shutdown_timeout_ms = 500; // Fast shutdown for tests
|
||||
|
||||
var config_b = p2p.P2PConfig.default();
|
||||
config_b.network.listen_port = 19312;
|
||||
config_b.network.enable_noise_encryption = false;
|
||||
config_b.file_sharing.piece_size = 512;
|
||||
config_b.file_sharing.allowed_share_directories = &[_][]const u8{"tests/test_data"};
|
||||
config_b.library.shutdown_timeout_ms = 500; // Fast shutdown for tests
|
||||
@@ -321,14 +326,17 @@ test "e2e file transfer: multiple pieces verification" {
|
||||
defer std.fs.cwd().deleteFile(dest_path) catch {};
|
||||
|
||||
// Create two P2P instances with small piece size to test multiple pieces
|
||||
// Noise disabled — testing file transfer, not encryption
|
||||
var config_a = p2p.P2PConfig.default();
|
||||
config_a.network.listen_port = 19321;
|
||||
config_a.network.enable_noise_encryption = false;
|
||||
config_a.file_sharing.piece_size = 1024; // 8 pieces total
|
||||
config_a.file_sharing.allowed_share_directories = &[_][]const u8{"tests/test_data"};
|
||||
config_a.library.shutdown_timeout_ms = 500; // Fast shutdown for tests
|
||||
|
||||
var config_b = p2p.P2PConfig.default();
|
||||
config_b.network.listen_port = 19322;
|
||||
config_b.network.enable_noise_encryption = false;
|
||||
config_b.file_sharing.piece_size = 1024;
|
||||
config_b.file_sharing.allowed_share_directories = &[_][]const u8{"tests/test_data"};
|
||||
config_b.library.shutdown_timeout_ms = 500; // Fast shutdown for tests
|
||||
@@ -451,6 +459,7 @@ test "e2e infrastructure: file sharing session lifecycle" {
|
||||
|
||||
var config = p2p.P2PConfig.default();
|
||||
config.network.listen_port = 19331;
|
||||
config.network.enable_noise_encryption = false;
|
||||
config.file_sharing.allowed_share_directories = &[_][]const u8{"tests/test_data"};
|
||||
config.library.shutdown_timeout_ms = 500; // Fast shutdown for tests
|
||||
|
||||
@@ -480,6 +489,7 @@ test "e2e infrastructure: concurrent transfer support" {
|
||||
|
||||
var config = p2p.P2PConfig.default();
|
||||
config.network.listen_port = 19341;
|
||||
config.network.enable_noise_encryption = false;
|
||||
config.file_sharing.max_concurrent_downloads = 3;
|
||||
config.file_sharing.max_concurrent_uploads = 5;
|
||||
config.library.shutdown_timeout_ms = 500; // Fast shutdown for tests
|
||||
|
||||
Reference in New Issue
Block a user