mirror of
https://github.com/DeterminateSystems/flake-checker.git
synced 2024-10-05 18:27:42 +03:00
Add test for explicit nixpkgs keys
This commit is contained in:
parent
cbff039610
commit
1e03b73ddb
37
src/flake.rs
37
src/flake.rs
@ -222,7 +222,7 @@ impl FlakeLock {
|
||||
|
||||
if !missing.is_empty() {
|
||||
let error_msg = format!(
|
||||
"no Nixpkgs dependency found for specified {}: {}",
|
||||
"no nixpkgs dependency found for specified {}: {}",
|
||||
if missing.len() > 1 { "keys" } else { "key" },
|
||||
missing.join(", ")
|
||||
);
|
||||
@ -320,7 +320,8 @@ mod test {
|
||||
check_outdated: false,
|
||||
..Default::default()
|
||||
};
|
||||
let issues = check_flake_lock(&flake_lock, &config);
|
||||
let issues = check_flake_lock(&flake_lock, &config)
|
||||
.expect("couldn't run check_flake_lock function");
|
||||
assert!(issues.is_empty());
|
||||
}
|
||||
}
|
||||
@ -379,7 +380,37 @@ mod test {
|
||||
check_outdated: false,
|
||||
..Default::default()
|
||||
};
|
||||
let issues = check_flake_lock(&flake_lock, &config);
|
||||
let issues = check_flake_lock(&flake_lock, &config)
|
||||
.expect("couldn't run check_flake_lock function");
|
||||
assert_eq!(issues, expected_issues);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_explicit_nixpkgs_keys() {
|
||||
let cases: Vec<(&str, Vec<String>, Vec<Issue>)> = vec![(
|
||||
"flake.explicit-keys.0.lock",
|
||||
vec![String::from("nixpkgs"), String::from("nixpkgs-alt")],
|
||||
vec![Issue {
|
||||
dependency: String::from("nixpkgs-alt"),
|
||||
kind: IssueKind::NonUpstream,
|
||||
details: json!({
|
||||
"input": String::from("nixpkgs-alt"),
|
||||
"owner": String::from("seems-pretty-shady"),
|
||||
}),
|
||||
}],
|
||||
)];
|
||||
|
||||
for (file, nixpkgs_keys, expected_issues) in cases {
|
||||
let path = format!("tests/{file}");
|
||||
let flake_lock = FlakeLock::new(&path.into()).expect("couldn't create flake.lock");
|
||||
let config = FlakeCheckConfig {
|
||||
check_outdated: false,
|
||||
nixpkgs_keys,
|
||||
..Default::default()
|
||||
};
|
||||
let issues = check_flake_lock(&flake_lock, &config)
|
||||
.expect("couldn't run check_flake_lock function");
|
||||
assert_eq!(issues, expected_issues);
|
||||
}
|
||||
}
|
||||
|
171
tests/flake.explicit-keys.0.lock
Normal file
171
tests/flake.explicit-keys.0.lock
Normal file
@ -0,0 +1,171 @@
|
||||
{
|
||||
"nodes": {
|
||||
"crane": {
|
||||
"inputs": {
|
||||
"flake-compat": [
|
||||
"flake-compat"
|
||||
],
|
||||
"flake-utils": [
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"rust-overlay": "rust-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1684468982,
|
||||
"narHash": "sha256-EoC1N5sFdmjuAP3UOkyQujSOT6EdcXTnRw8hPjJkEgc=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "99de890b6ef4b4aab031582125b6056b792a4a30",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673956053,
|
||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1681202837,
|
||||
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "flake-utils",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1686960236,
|
||||
"narHash": "sha256-AYCC9rXNLpUWzD9hm+askOfpliLEC9kwAo7ITJc4HIw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "04af42f3b31dba0ef742d254456dc4c14eedac86",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-alt": {
|
||||
"locked": {
|
||||
"lastModified": 1686960236,
|
||||
"narHash": "sha256-AYCC9rXNLpUWzD9hm+askOfpliLEC9kwAo7ITJc4HIw=",
|
||||
"owner": "seems-pretty-shady",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "04af42f3b31dba0ef742d254456dc4c14eedac86",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "seems-pretty-shady",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"crane": "crane",
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-alt": "nixpkgs-alt",
|
||||
"rust-overlay": "rust-overlay_2"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"crane",
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"crane",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1683080331,
|
||||
"narHash": "sha256-nGDvJ1DAxZIwdn6ww8IFwzoHb2rqBP4wv/65Wt5vflk=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "d59c3fa0cba8336e115b376c2d9e91053aa59e56",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"rust-overlay_2": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1684808436,
|
||||
"narHash": "sha256-WG5LgB1+Oguj4H4Bpqr5GoLSc382LyGlaToiOw5xhwA=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "a227d4571dd1f948138a40ea8b0d0c413eefb44b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
Loading…
Reference in New Issue
Block a user