Skip to content

Commit

Permalink
tests: seq command name of block types to increase eval coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
blaggacao committed Jun 30, 2023
1 parent a1ef840 commit 870a28a
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 38 deletions.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions src/local/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/tests/checks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ let
inherit (inputs) namaka self;
inputs' = builtins.removeAttrs inputs ["self"];
in {
inherit inputs;
snapshots = {
meta.description = "The main Standard Snapshotting test suite";
check = namaka.lib.load {
src = self + /tests;
inputs = inputs' // {inputs = inputs';};
inputs =
inputs'
//
# inputs.self is too noisy for 'check-augmented-cell-inputs'
{inputs = inputs';};
};
};
}
62 changes: 51 additions & 11 deletions src/tests/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/tests/flake.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
{
inputs = {
# injected inputs to override std's defaults
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
devshell.url = "github:numtide/devshell";
devshell.inputs.nixpkgs.follows = "nixpkgs";
nixago.url = "github:nix-community/nixago";
nixago.inputs.nixpkgs.follows = "nixpkgs";
nixago.inputs.nixago-exts.follows = "";
n2c.url = "github:nlewo/nix2container";
n2c.inputs.nixpkgs.follows = "nixpkgs";
terranix.url = "github:terranix/terranix";
terranix.inputs.nixpkgs.follows = "nixpkgs";
terranix.inputs.terranix-examples.follows = "";
terranix.inputs.bats-support.follows = "";
terranix.inputs.bats-assert.follows = "";
namaka.url = "github:nix-community/namaka/v0.2.0";
namaka.inputs.haumea.follows = "std/haumea";
namaka.inputs.nixpkgs.follows = "nixpkgs";
Expand Down
6 changes: 3 additions & 3 deletions tests/_snapshots/check-augmented-cell-inputs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
n2c = "/nix/store/rgd4s5ylv38p94wi6vays6wc1a0l5iyf-source";
namaka = "/nix/store/xgzvi3baaaz9lpymfv6f1fgxfmy0ygvv-source";
nixago = "/nix/store/cys15p6lyyhj85bk4bckn82waih2l945-source";
nixpkgs = "/nix/store/yf26s7734ql7q05zlq6nq4y5q3rjyhj7-source";
paisano = "/nix/store/s337m30p13frssxlflicvjan4kn5asli-source";
nixpkgs = "/nix/store/mz6lqpbsp4h36kgahvwfrgdjzz042hpn-source";
paisano = "/nix/store/cc3rw362kjklbj3cggblr1338mcszpwb-source";
paisano-tui = "/nix/store/w5wg8h6506raj0qxwal4w8hg7iwchnv5-source";
terranix = "/nix/store/scflkbbsqxlzxvja3gm4xf1y2kvsww32-source";
terranix = "/nix/store/agasgh0qgqi0fxk3zzgrjvqpx6k8036c-source";
yants = "/nix/store/np6pvhkza8grv26qypzpibwrrg7kqxkc-source";
}
61 changes: 48 additions & 13 deletions tests/bt-blocktypes/expr.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
{
inputs,
std,
flake-parts,
nixpkgs,
}: let
inherit (builtins) mapAttrs concatStringsSep;
inherit (nixpkgs.lib) splitString drop;
inherit (builtins) mapAttrs concatStringsSep seq;
inherit (nixpkgs.lib) splitString drop pipe;
trimProvisoPath = a:
if a ? proviso
then a // {proviso = concatStringsSep "/" (drop 4 (splitString "/" a.proviso));}
else a;
evalCommand = a:
if a ? command
then seq a.command.outPath a
else a;
in
mapAttrs (
n: f: let
Expand All @@ -18,14 +21,42 @@ in
}
.${n}
or (f n)) ["__functor"];
buildable = {drvPath = "drvPath";};
buildable = {
drvPath = "drvPath";
outPath = "outPath";
};
targets = {
runnables = buildable;
runnables = buildable // {pname = "runnable";};
installables = buildable;
devshells = buildable;
files = "file/path";
nomad = {
job = {};
};
nixago = {
install = "install";
config = "path/to/config";
};
microvms = {
config.microvm.runner.foo = "42";
config.microvm.hypervisor = "foo";
};
devshells =
buildable
// {
drvAttrs = {
builder = "builder";
system = "system";
name = "devshell";
args = "args";
};
};
arion = {
config.out.dockerComposeYaml = "docker-compose.yaml";
};
containers =
buildable
// {
name = "name";
image = {
name = "repo:tag";
repo = "repo";
Expand All @@ -39,13 +70,17 @@ in
then
action
// {
actions = map trimProvisoPath (action.actions {
inherit inputs;
currentSystem = inputs.nixpkgs.system;
fragment = "f.r.a.g.m.e.n.t";
fragmentRelPath = "x86/f/r/a/g/m/e/n/t";
target = targets.${n} or {};
});
actions =
pipe (action.actions {
inherit inputs;
currentSystem = inputs.nixpkgs.system;
fragment = "f.r.a.g.m.e.n.t";
fragmentRelPath = "x86/f/r/a/g/m/e/n/t";
target = targets.${n} or {};
}) [
(map trimProvisoPath)
(map evalCommand)
];
}
else action
)
Expand Down

0 comments on commit 870a28a

Please sign in to comment.