Skip to content

Commit

Permalink
Make deterministic
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelzw committed Nov 14, 2024
1 parent f119c98 commit 4ef05c1
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 99 deletions.
56 changes: 29 additions & 27 deletions crates/rattler/src/install/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -906,37 +906,39 @@ mod test {
insta::assert_yaml_snapshot!(paths);
}

#[rstest::rstest]
#[case(
"https://conda.anaconda.org/conda-forge/win-64/ruff-0.0.171-py310h298983d_0.conda",
"25c755b97189ee066576b4ae3999d5e7ff4406d236b984742194e63941838dcd"
)]
#[case(
"https://conda.anaconda.org/conda-forge/linux-aarch64/bzip2-1.0.8-hf897c2e_4.tar.bz2",
"3aeb6ab92aa0351722497b2d2a735dc20921cf6c60d9196c04b7a2b9ece198d2"
)]
#[tracing_test::traced_test]
#[tokio::test]
async fn test_link_package_from_archive(#[case] package_url: &str, #[case] sha256: &str) {
let environment_dir = tempfile::TempDir::new().unwrap();
async fn test_link_package_from_archive() {
let packages = vec![(
"https://conda.anaconda.org/conda-forge/win-64/ruff-0.0.171-py310h298983d_0.conda",
"25c755b97189ee066576b4ae3999d5e7ff4406d236b984742194e63941838dcd"
),
(
"https://conda.anaconda.org/conda-forge/linux-aarch64/bzip2-1.0.8-hf897c2e_4.tar.bz2",
"3aeb6ab92aa0351722497b2d2a735dc20921cf6c60d9196c04b7a2b9ece198d2"
)];

for (package_url, sha256) in packages {
let environment_dir = tempfile::TempDir::new().unwrap();

let package_path =
tools::download_and_cache_file_async(package_url.parse().unwrap(), sha256)
.await
.unwrap();

let package_path =
tools::download_and_cache_file_async(package_url.parse().unwrap(), sha256)
.await
.unwrap();
let install_driver = InstallDriver::default();

let install_driver = InstallDriver::default();

// Link the package
let paths = link_package_from_archive(
&package_path,
environment_dir.path(),
&install_driver,
InstallOptions::default(),
)
.await
.unwrap();
// Link the package
let paths = link_package_from_archive(
&package_path,
environment_dir.path(),
&install_driver,
InstallOptions::default(),
)
.await
.unwrap();

insta::assert_yaml_snapshot!(paths);
insta::assert_yaml_snapshot!(paths);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,76 +1,126 @@
---
source: crates/rattler/src/install/mod.rs
assertion_line: 940
assertion_line: 941
expression: paths
snapshot_kind: text
---
- _path: Lib/site-packages/ruff-0.0.171.dist-info/INSTALLER
path_type: hardlink
sha256: d0edee15f91b406f3f99726e44eb990be6e34fd0345b52b910c568e0eef6a2a8
sha256_in_prefix: d0edee15f91b406f3f99726e44eb990be6e34fd0345b52b910c568e0eef6a2a8
size_in_bytes: 5
- _path: Lib/site-packages/ruff-0.0.171.dist-info/METADATA
path_type: hardlink
sha256: fba95fb4a3bb15c300e3950b2b912425b0163a9e8e2faae8a68d867bdfec7819
sha256_in_prefix: fba95fb4a3bb15c300e3950b2b912425b0163a9e8e2faae8a68d867bdfec7819
size_in_bytes: 77203
- _path: Lib/site-packages/ruff-0.0.171.dist-info/RECORD
path_type: hardlink
sha256: b821cd5c255c078e53c904846b95e0bd9f73bc7764538cf9fd1181b8d7c2b628
sha256_in_prefix: b821cd5c255c078e53c904846b95e0bd9f73bc7764538cf9fd1181b8d7c2b628
size_in_bytes: 896
- _path: Lib/site-packages/ruff-0.0.171.dist-info/REQUESTED
path_type: hardlink
sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
sha256_in_prefix: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
size_in_bytes: 0
- _path: Lib/site-packages/ruff-0.0.171.dist-info/WHEEL
path_type: hardlink
sha256: 48809079c83d2fc9b7581bb1a3ea375f6eaea7074b0a722c0ada479f78d54f35
sha256_in_prefix: 48809079c83d2fc9b7581bb1a3ea375f6eaea7074b0a722c0ada479f78d54f35
size_in_bytes: 94
- _path: Lib/site-packages/ruff-0.0.171.dist-info/direct_url.json
path_type: hardlink
sha256: 88d97db3dccb9ab7f8ff5a8d3c3405297e111364375ccd848a9966906c900d6a
sha256_in_prefix: 88d97db3dccb9ab7f8ff5a8d3c3405297e111364375ccd848a9966906c900d6a
size_in_bytes: 119
- _path: Lib/site-packages/ruff-0.0.171.dist-info/license_files/LICENSE
path_type: hardlink
sha256: 0891ad47212cb60b4d5f277b3b18fd44f8c3501d2612bbac0325bd332173d49e
sha256_in_prefix: 0891ad47212cb60b4d5f277b3b18fd44f8c3501d2612bbac0325bd332173d49e
size_in_bytes: 30157
- _path: Lib/site-packages/ruff/__init__.py
path_type: hardlink
sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
sha256_in_prefix: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
size_in_bytes: 0
- _path: Lib/site-packages/ruff/__main__.py
path_type: hardlink
sha256: 86de2c033f7285b67662e60d06ee9837c0fd9ba128a72bb271eb6d1f75c4f902
sha256_in_prefix: 86de2c033f7285b67662e60d06ee9837c0fd9ba128a72bb271eb6d1f75c4f902
size_in_bytes: 193
- _path: Lib/site-packages/ruff/__pycache__/__init__.cpython-310.pyc
path_type: hardlink
sha256: 9c830b0cbcd46189b34cabed42a002bd0faeba9abdd48979079dec18bdfb540e
sha256_in_prefix: 9c830b0cbcd46189b34cabed42a002bd0faeba9abdd48979079dec18bdfb540e
size_in_bytes: 160
- _path: Lib/site-packages/ruff/__pycache__/__init__.cpython-311.pyc
path_type: hardlink
sha256: 890732d0bad13b143e69f22d2e81e11ce746f225a418f0382fc153cfcabf7b35
sha256_in_prefix: 890732d0bad13b143e69f22d2e81e11ce746f225a418f0382fc153cfcabf7b35
size_in_bytes: 143
- _path: Lib/site-packages/ruff/__pycache__/__main__.cpython-310.pyc
path_type: hardlink
sha256: a212e166b246f05caa68ba296261d9b5ca3554a4c0f9b4b266c45759df7c5abd
sha256_in_prefix: a212e166b246f05caa68ba296261d9b5ca3554a4c0f9b4b266c45759df7c5abd
size_in_bytes: 383
- _path: Lib/site-packages/ruff/__pycache__/__main__.cpython-311.pyc
path_type: hardlink
sha256: da00646e8afbeca6ed78d3159d231e198dbf4950e92cec6cdf629e2fbd620a60
sha256_in_prefix: da00646e8afbeca6ed78d3159d231e198dbf4950e92cec6cdf629e2fbd620a60
size_in_bytes: 629
- _path: Scripts/ruff.exe
path_type: hardlink
sha256: 268820aa3008ea202b779382ac80b09d81ee1de26e72fdc5d0feca05b3d94e09
sha256_in_prefix: 268820aa3008ea202b779382ac80b09d81ee1de26e72fdc5d0feca05b3d94e09
size_in_bytes: 6896640
- _path: bin/bunzip2
path_type: hardlink
sha256: 04f60342b7332b849c3d0e3896322c3b92d8bcfc822c3be0ffd80332b3c223d4
sha256_in_prefix: 04f60342b7332b849c3d0e3896322c3b92d8bcfc822c3be0ffd80332b3c223d4
size_in_bytes: 366552
- _path: bin/bzcat
path_type: hardlink
sha256: 04f60342b7332b849c3d0e3896322c3b92d8bcfc822c3be0ffd80332b3c223d4
sha256_in_prefix: 04f60342b7332b849c3d0e3896322c3b92d8bcfc822c3be0ffd80332b3c223d4
size_in_bytes: 366552
- _path: bin/bzcmp
path_type: softlink
sha256: 1c1f96193cdf14b85ea65f140a7557a07ece8783a53ec5ba6b5c30644a9d3012
sha256_in_prefix: d5e2951edcc0388feda0726ee69b5ac079bf91e4bc79ce095b34a56b38db29b7
size_in_bytes: 2140
- _path: bin/bzdiff
path_type: hardlink
sha256: 1c1f96193cdf14b85ea65f140a7557a07ece8783a53ec5ba6b5c30644a9d3012
sha256_in_prefix: 1c1f96193cdf14b85ea65f140a7557a07ece8783a53ec5ba6b5c30644a9d3012
size_in_bytes: 2140
- _path: bin/bzegrep
path_type: softlink
sha256: a8e368a31766c7862b8d0feeffe274c3bb43b969e3ccb4f9e77d13bfa447a5c9
sha256_in_prefix: aa3149e6182875b6fc8b393c9b556fa49427b8732e87c5def2e109904143caa3
size_in_bytes: 2054
- _path: bin/bzfgrep
path_type: softlink
sha256: a8e368a31766c7862b8d0feeffe274c3bb43b969e3ccb4f9e77d13bfa447a5c9
sha256_in_prefix: aa3149e6182875b6fc8b393c9b556fa49427b8732e87c5def2e109904143caa3
size_in_bytes: 2054
- _path: bin/bzgrep
path_type: hardlink
sha256: a8e368a31766c7862b8d0feeffe274c3bb43b969e3ccb4f9e77d13bfa447a5c9
sha256_in_prefix: a8e368a31766c7862b8d0feeffe274c3bb43b969e3ccb4f9e77d13bfa447a5c9
size_in_bytes: 2054
- _path: bin/bzip2
path_type: hardlink
sha256: 04f60342b7332b849c3d0e3896322c3b92d8bcfc822c3be0ffd80332b3c223d4
sha256_in_prefix: 04f60342b7332b849c3d0e3896322c3b92d8bcfc822c3be0ffd80332b3c223d4
size_in_bytes: 366552
- _path: bin/bzip2recover
path_type: hardlink
sha256: 0eacb81fcff1adb72a67efa1f01074c3119ff46709187eada93560533412b38b
sha256_in_prefix: 0eacb81fcff1adb72a67efa1f01074c3119ff46709187eada93560533412b38b
size_in_bytes: 35896
- _path: bin/bzless
path_type: softlink
sha256: 836536d4c7469788c730355d59f8ae8d16ba07cb0754174878d99ed90f04448d
sha256_in_prefix: 97fc73f3676c65ae05a49cad2afb3126a00baf9dbf2613996e3b95eac6364c32
size_in_bytes: 1259
- _path: bin/bzmore
path_type: hardlink
sha256: 836536d4c7469788c730355d59f8ae8d16ba07cb0754174878d99ed90f04448d
sha256_in_prefix: 836536d4c7469788c730355d59f8ae8d16ba07cb0754174878d99ed90f04448d
size_in_bytes: 1259
- _path: include/bzlib.h
path_type: hardlink
sha256: 6ac62e811669598ee30c9e1c379b9e627f6ff17a5a3dc1e0b4fa8b8ea75e580d
sha256_in_prefix: 6ac62e811669598ee30c9e1c379b9e627f6ff17a5a3dc1e0b4fa8b8ea75e580d
size_in_bytes: 6240
- _path: lib/libbz2.a
path_type: hardlink
sha256: ece8562c4d98e21896056c3f195f0f1b0afed89188fc0e17a8ca53664c28d5bf
sha256_in_prefix: ece8562c4d98e21896056c3f195f0f1b0afed89188fc0e17a8ca53664c28d5bf
size_in_bytes: 371082
- _path: lib/libbz2.so
path_type: softlink
sha256: d24341372acf8be384d59dedca008fa3052d7d2deab7f8e79410f73383d15b28
sha256_in_prefix: 7136a6a39c8e423501e3cefc44a552170b1e996ffd43185357640572e3d38394
size_in_bytes: 286272
- _path: lib/libbz2.so.1.0
path_type: softlink
sha256: d24341372acf8be384d59dedca008fa3052d7d2deab7f8e79410f73383d15b28
sha256_in_prefix: 7136a6a39c8e423501e3cefc44a552170b1e996ffd43185357640572e3d38394
size_in_bytes: 286272
- _path: lib/libbz2.so.1.0.8
path_type: hardlink
sha256: d24341372acf8be384d59dedca008fa3052d7d2deab7f8e79410f73383d15b28
sha256_in_prefix: d24341372acf8be384d59dedca008fa3052d7d2deab7f8e79410f73383d15b28
size_in_bytes: 286272
- _path: man/man1/bzcmp.1
path_type: hardlink
sha256: 172cde42c47a6d50c244e39d993097dcd3882427d57303078643849cf10a81c4
sha256_in_prefix: 172cde42c47a6d50c244e39d993097dcd3882427d57303078643849cf10a81c4
size_in_bytes: 18
- _path: man/man1/bzdiff.1
path_type: hardlink
sha256: 32d1a7cd115430398e58537532584ef2ab76343c9f094dcd1253d9c4c0f705bf
sha256_in_prefix: 32d1a7cd115430398e58537532584ef2ab76343c9f094dcd1253d9c4c0f705bf
size_in_bytes: 897
- _path: man/man1/bzegrep.1
path_type: hardlink
sha256: cf1c98d3fa055506c8af2f8bba4da9c17d367c6409c6ad83a2bc67ccb6630182
sha256_in_prefix: cf1c98d3fa055506c8af2f8bba4da9c17d367c6409c6ad83a2bc67ccb6630182
size_in_bytes: 18
- _path: man/man1/bzfgrep.1
path_type: hardlink
sha256: cf1c98d3fa055506c8af2f8bba4da9c17d367c6409c6ad83a2bc67ccb6630182
sha256_in_prefix: cf1c98d3fa055506c8af2f8bba4da9c17d367c6409c6ad83a2bc67ccb6630182
size_in_bytes: 18
- _path: man/man1/bzgrep.1
path_type: hardlink
sha256: 924aa4a7c7c1467400181e4c0ee1b527db142b6399a717171f2351b72b5899df
sha256_in_prefix: 924aa4a7c7c1467400181e4c0ee1b527db142b6399a717171f2351b72b5899df
size_in_bytes: 1297
- _path: man/man1/bzip2.1
path_type: hardlink
sha256: 27b984bb2e8bbee2651d11cda87449cfc4138d2e479b9eaa77b8f60fa5d0bf5d
sha256_in_prefix: 27b984bb2e8bbee2651d11cda87449cfc4138d2e479b9eaa77b8f60fa5d0bf5d
size_in_bytes: 16266
- _path: man/man1/bzless.1
path_type: hardlink
sha256: 216898f9b8acf61eeb471ecf23e47c1452dfd648f7f38d7d3bf48627072dc52c
sha256_in_prefix: 216898f9b8acf61eeb471ecf23e47c1452dfd648f7f38d7d3bf48627072dc52c
size_in_bytes: 18
- _path: man/man1/bzmore.1
path_type: hardlink
sha256: ccfcf3f995e11adae3035e287252091bb72d165da21e0c385a4965d17c9051c7
sha256_in_prefix: ccfcf3f995e11adae3035e287252091bb72d165da21e0c385a4965d17c9051c7
size_in_bytes: 4310
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
source: crates/rattler/src/install/mod.rs
assertion_line: 940
assertion_line: 941
expression: paths
snapshot_kind: text
---
Expand Down

0 comments on commit 4ef05c1

Please sign in to comment.