You are browsing as a guest. Sign up (or log in) to start making projects!

2h 0m logged

Add end-to-end integration tests for full client-server lifecycle

Implement two end-to-end tests using paired in-memory byte streams (Pipe
struct implementing Read+Write via Arc<Mutex<Vec») that simulate a
complete client-server interaction without network dependencies.

test_full_client_server_archive_restore_cycle creates a multi-file project
directory, generates age encryption keys and a PSK, runs the archive
pipeline to produce an encrypted blob, then spawns two threads for client
and server communicating through paired pipes. The client performs the
full protocol sequence: Handshake with HMAC-SHA256 proof, ArchiveRequest
with project metadata, chunked data transfer with 1 MiB chunks and
zero-length EOF marker, and ArchiveComplete with SHA-256 hash. The server
thread receives the Handshake, verifies the client proof, responds with
its own server proof for mutual authentication, reads the ArchiveRequest,
receives all chunks via the 4-byte length-prefixed streaming protocol, and
acknowledges ArchiveComplete. After both threads join, assertions verify
the server received the exact encrypted blob, decryption succeeds, and the
local project metadata transitions correctly through local → archived →
placeholder states with .project.toml file survival.

test_end_to_end_hash_verification_prevents_corruption validates that
tampering with a single byte of the encrypted archive produces a different
SHA-256 hash, ensuring integrity violations are detectable before
extraction.

0
0

Comments 0

No comments yet. Be the first!