#assets #download #git #ureq #backoff #test #test-assets

test-assets-ureq

Download test assets with ureq, managing them outside of git

1 unstable release

0.3.0 Nov 9, 2024

#448 in Cryptography

Download history 447/week @ 2024-11-04 1086/week @ 2024-11-11 334/week @ 2024-11-18 799/week @ 2024-11-25 140/week @ 2024-12-02 130/week @ 2024-12-09

1,443 downloads per month
Used in 2 crates

MIT/Apache

11KB
213 lines

Test Assets

Download test assets, managing them outside of git.

Changes from being a fork of test-assets:

  • Use rust library ureq and avoid compiling curl for test binaries
  • Includes backoff support

Compiler support: requires rustc 1.70.0+


lib.rs:

Download test assets, managing them outside of git

This library downloads test assets using http(s), and ensures integrity by comparing those assets to a hash. By managing the download separately, you can keep them out of VCS and don't make them bloat your repository.

Usage example:

#[test]
fn some_awesome_test() {
let asset_defs = [
TestAssetDef {
filename : format!("file_a.png"),
hash : format!("<sha256 here>"),
url : format!("https://url/to/a.png"),
},
TestAssetDef {
filename : format!("file_b.png"),
hash : format!("<sha256 here>"),
url : format!("https://url/to/a.png"),
},
];
test_assets::dl_test_files(&asset_defs,
"test-assets", true).unwrap();
// use your files here
// with path under test-assets/file_a.png and test-assets/file_b.png
}

If you have run the test once, it will re-use the files instead of re-downloading them.

Dependencies

~3–4.5MB
~80K SLoC