diff options
author | sinanmohd <sinan@sinanmohd.com> | 2024-08-12 23:17:33 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2024-08-12 23:21:13 +0530 |
commit | ca46628491546f2e7e846c114e748bae7b527595 (patch) | |
tree | f210439ed82e5f379abf9f842328622473dbf34a | |
parent | b31a7597c14189faa8f8da99305b964d3cb86de0 (diff) |
nixosTests/dsl: make sure cache value is valid
-rw-r--r-- | nixos/tests/dsl.nix | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/nixos/tests/dsl.nix b/nixos/tests/dsl.nix index 341207c..4d59bcb 100644 --- a/nixos/tests/dsl.nix +++ b/nixos/tests/dsl.nix @@ -30,14 +30,14 @@ let }; options.cache = lib.mkOption { type = lib.types.enum [ - "none" + "unbuilt" "remote" "local" ]; description = '' Whether the dependency is pre-built and available in the local /nix/store ("local"), can be substituted ("remote"), or has to be built ("none") ''; - default = "none"; + default = "unbuilt"; }; options.inputs = lib.mkOption { type = lib.types.attrsOf (lib.types.submodule Dependency); @@ -175,12 +175,15 @@ in for name, node in nodes.items(): error_msg = f"Wrong plan for {name}" + action = drv_to_action.get(name, None) if node["cache"] == "local": - assert name not in drv_to_action, error_msg + assert action is None, error_msg elif node["cache"] == "remote": - assert drv_to_action.get(name, None) == "fetch", error_msg + assert action == "fetch", error_msg elif node["cache"] == "unbuilt": - assert drv_to_action.get(name, None) == "build", error_msg + assert action == "build", error_msg + else: + raise AssertionError('cache is not in [ "local", "remote", "unbuilt" ]') need_dls, need_builds = set(), set() for name, node in nodes.items(): |