Skip to main content

Crate ustar_test_utils

Crate ustar_test_utils 

Source
Expand description

Shared test utilities for ustar crates.

This crate provides common testing functionality including support for gzip-compressed snapshot files, test data management, and mock HTTP clients for testing download functionality.

Structs§

MockHttpClient
Mock HTTP client for testing with pre-recorded responses
SnapshotMismatch
Result of a snapshot check - either Ok or a mismatch with details

Functions§

assert_snapshot_gz
Custom assertion that works with zstd compressed snapshots. Works like insta::assert_snapshot! but reads from .snap.zst files. Panics on mismatch - use check_snapshot_gz if you need to collect multiple failures.
check_snapshot_gz
Check a snapshot without panicking. Returns Ok(()) if the snapshot matches, or Err(SnapshotMismatch) if there’s a mismatch. Creates .snap.new and .snap.diff files on mismatch for later review/acceptance.
ensure_test_data_available
Ensure test data is available and verified
read_snapshot
Read a snapshot file, automatically decompressing if it’s zstd compressed Returns the FULL file content including headers
verify_test_data_checksums
Verify checksums for all files in a test data directory