aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-13 03:41:54 +0000
committertv <tv@krebsco.de>2026-11-13 03:41:54 +0000
commite90426e9abf1370851cd24557ae7ac897cdef297 (patch)
tree4a7ab50874f6771e137a5799e1e870228484918e /tests
parent0842652921304ba76fbd321756b6b545abc81b01 (diff)
populate: fail on inputs drawn that the flake doesn't have
Nix ignores an input that --override-input names but the flake doesn't have, with a warning, so a misspelt input name in inputs draws nothing, and the source keeps using its own input. Before changing anything, populate locks the flake of each source that draws inputs, with an empty flake in place of each input drawn, which may be unreachable, and fails, naming the source and the input, unless the flake has each input drawn. Below an input drawn from a source, the path continues in the flake of that source. An edge case misspells an input of the source's flake, and one below an input drawn from a source, both ways of drawing inputs.
Diffstat (limited to 'tests')
-rw-r--r--tests/scenarios.nix24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/scenarios.nix b/tests/scenarios.nix
index 89a3b09..e23d14e 100644
--- a/tests/scenarios.nix
+++ b/tests/scenarios.nix
@@ -1445,6 +1445,30 @@ assert !(krops.isLocalTarget (targets.remote "/"));
'';
}];
})
+ # Misspelt input names draw nothing, so they fail before anything
+ # changes: of the source's flake, and below an input drawn from a source.
+ (modes "inputs-typo" ({ draw, ... }: {
+ phases = [
+ {
+ sources = alt // {
+ x.flake-input = {
+ url = "/fixtures/top"; name = "dep"; inherit fetchOnTarget;
+ } // draw { innr.follows = "alt"; };
+ };
+ expect.fail = "error: source x draws input innr from source alt, but its flake has no input innr";
+ }
+ {
+ sources = {
+ x.flake = {
+ url = "/fixtures/top"; inherit fetchOnTarget;
+ } // draw { dep = { follows = "b"; inputs.qq.follows = "c2"; }; };
+ b.file = "/fixtures/two";
+ c2.file = "/fixtures/c2";
+ };
+ expect.fail = "error: source x draws input dep/qq from source c2, but the flake of source b has no input qq";
+ }
+ ];
+ }))
# A signal ending populate leaves neither the ssh master nor the
# temporary directory.
(s "interrupt" {