From a5915b6c993052920d39b1d9719640569b866ead Mon Sep 17 00:00:00 2001 From: Erin van der Veen Date: Tue, 5 Mar 2024 20:56:11 +0100 Subject: [PATCH] feat: test substituters by actually attempting to fetch from them --- src/nix/substituters.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/nix/substituters.rs b/src/nix/substituters.rs index 6255b2d..949e4ab 100644 --- a/src/nix/substituters.rs +++ b/src/nix/substituters.rs @@ -87,4 +87,15 @@ mod tests { assert!(substituters.is_ok()); } + + /// This test gets the substituters and passes them along to the + /// NarInfo::fetch function to ensure they are correct. + #[test] + fn test_get_substituters() { + let store_path = "/nix/store/1gxz5nfzfnhyxjdyzi04r86sh61y4i00-hello-2.12.1"; + let substituters = get_substituters("nixpkgs".to_owned()).unwrap(); + let nar_info = crate::narinfo::NarInfo::fetch(store_path, &substituters); + + assert!(nar_info.is_ok_and(|n| n.is_some_and(|n| n.store_path == store_path))) + } }