MCPcopy Index your code
hub / github.com/cargo-lambda/cargo-lambda / test_consistent_hash

Function test_consistent_hash

crates/cargo-lambda-build/src/archive.rs:656–672  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

654
655 #[test]
656 fn test_consistent_hash() {
657 let data = BinaryData::new("binary-x86-64", false, false);
658
659 let bp = "../../tests/binaries/binary-x86-64";
660 let dd = TempDir::with_prefix("cargo-lambda-").expect("failed to create temp dir");
661
662 let archive1 =
663 zip_binary(bp, dd.path(), &data, None).expect("failed to create binary archive");
664
665 // Sleep to ensure that the mtime is different enough for the hash to change
666 sleep(Duration::from_secs(2));
667
668 let archive2 =
669 zip_binary(bp, dd.path(), &data, None).expect("failed to create binary archive");
670
671 assert_eq!(archive1.sha256().unwrap(), archive2.sha256().unwrap());
672 }
673
674 #[test]
675 fn test_create_binary_archive_with_base_path() {

Callers

nothing calls this directly

Calls 3

newFunction · 0.85
zip_binaryFunction · 0.85
pathMethod · 0.80

Tested by

no test coverage detected