Skip to content

Commit 870a28a

Browse files
committed
tests: seq command name of block types to increase eval coverage
1 parent a1ef840 commit 870a28a

File tree

7 files changed

+123
-38
lines changed

7 files changed

+123
-38
lines changed

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/local/flake.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tests/checks.nix

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@ let
22
inherit (inputs) namaka self;
33
inputs' = builtins.removeAttrs inputs ["self"];
44
in {
5+
inherit inputs;
56
snapshots = {
67
meta.description = "The main Standard Snapshotting test suite";
78
check = namaka.lib.load {
89
src = self + /tests;
9-
inputs = inputs' // {inputs = inputs';};
10+
inputs =
11+
inputs'
12+
//
13+
# inputs.self is too noisy for 'check-augmented-cell-inputs'
14+
{inputs = inputs';};
1015
};
1116
};
1217
}

src/tests/flake.lock

Lines changed: 51 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tests/flake.nix

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
{
22
inputs = {
33
# injected inputs to override std's defaults
4-
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
4+
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
55
devshell.url = "github:numtide/devshell";
66
devshell.inputs.nixpkgs.follows = "nixpkgs";
77
nixago.url = "github:nix-community/nixago";
88
nixago.inputs.nixpkgs.follows = "nixpkgs";
99
nixago.inputs.nixago-exts.follows = "";
1010
n2c.url = "github:nlewo/nix2container";
1111
n2c.inputs.nixpkgs.follows = "nixpkgs";
12+
terranix.url = "github:terranix/terranix";
13+
terranix.inputs.nixpkgs.follows = "nixpkgs";
14+
terranix.inputs.terranix-examples.follows = "";
15+
terranix.inputs.bats-support.follows = "";
16+
terranix.inputs.bats-assert.follows = "";
1217
namaka.url = "github:nix-community/namaka/v0.2.0";
1318
namaka.inputs.haumea.follows = "std/haumea";
1419
namaka.inputs.nixpkgs.follows = "nixpkgs";

tests/_snapshots/check-augmented-cell-inputs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
n2c = "/nix/store/rgd4s5ylv38p94wi6vays6wc1a0l5iyf-source";
1414
namaka = "/nix/store/xgzvi3baaaz9lpymfv6f1fgxfmy0ygvv-source";
1515
nixago = "/nix/store/cys15p6lyyhj85bk4bckn82waih2l945-source";
16-
nixpkgs = "/nix/store/yf26s7734ql7q05zlq6nq4y5q3rjyhj7-source";
17-
paisano = "/nix/store/s337m30p13frssxlflicvjan4kn5asli-source";
16+
nixpkgs = "/nix/store/mz6lqpbsp4h36kgahvwfrgdjzz042hpn-source";
17+
paisano = "/nix/store/cc3rw362kjklbj3cggblr1338mcszpwb-source";
1818
paisano-tui = "/nix/store/w5wg8h6506raj0qxwal4w8hg7iwchnv5-source";
19-
terranix = "/nix/store/scflkbbsqxlzxvja3gm4xf1y2kvsww32-source";
19+
terranix = "/nix/store/agasgh0qgqi0fxk3zzgrjvqpx6k8036c-source";
2020
yants = "/nix/store/np6pvhkza8grv26qypzpibwrrg7kqxkc-source";
2121
}

tests/bt-blocktypes/expr.nix

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
{
22
inputs,
33
std,
4-
flake-parts,
54
nixpkgs,
65
}: let
7-
inherit (builtins) mapAttrs concatStringsSep;
8-
inherit (nixpkgs.lib) splitString drop;
6+
inherit (builtins) mapAttrs concatStringsSep seq;
7+
inherit (nixpkgs.lib) splitString drop pipe;
98
trimProvisoPath = a:
109
if a ? proviso
1110
then a // {proviso = concatStringsSep "/" (drop 4 (splitString "/" a.proviso));}
1211
else a;
12+
evalCommand = a:
13+
if a ? command
14+
then seq a.command.outPath a
15+
else a;
1316
in
1417
mapAttrs (
1518
n: f: let
@@ -18,14 +21,42 @@ in
1821
}
1922
.${n}
2023
or (f n)) ["__functor"];
21-
buildable = {drvPath = "drvPath";};
24+
buildable = {
25+
drvPath = "drvPath";
26+
outPath = "outPath";
27+
};
2228
targets = {
23-
runnables = buildable;
29+
runnables = buildable // {pname = "runnable";};
2430
installables = buildable;
25-
devshells = buildable;
31+
files = "file/path";
32+
nomad = {
33+
job = {};
34+
};
35+
nixago = {
36+
install = "install";
37+
config = "path/to/config";
38+
};
39+
microvms = {
40+
config.microvm.runner.foo = "42";
41+
config.microvm.hypervisor = "foo";
42+
};
43+
devshells =
44+
buildable
45+
// {
46+
drvAttrs = {
47+
builder = "builder";
48+
system = "system";
49+
name = "devshell";
50+
args = "args";
51+
};
52+
};
53+
arion = {
54+
config.out.dockerComposeYaml = "docker-compose.yaml";
55+
};
2656
containers =
2757
buildable
2858
// {
59+
name = "name";
2960
image = {
3061
name = "repo:tag";
3162
repo = "repo";
@@ -39,13 +70,17 @@ in
3970
then
4071
action
4172
// {
42-
actions = map trimProvisoPath (action.actions {
43-
inherit inputs;
44-
currentSystem = inputs.nixpkgs.system;
45-
fragment = "f.r.a.g.m.e.n.t";
46-
fragmentRelPath = "x86/f/r/a/g/m/e/n/t";
47-
target = targets.${n} or {};
48-
});
73+
actions =
74+
pipe (action.actions {
75+
inherit inputs;
76+
currentSystem = inputs.nixpkgs.system;
77+
fragment = "f.r.a.g.m.e.n.t";
78+
fragmentRelPath = "x86/f/r/a/g/m/e/n/t";
79+
target = targets.${n} or {};
80+
}) [
81+
(map trimProvisoPath)
82+
(map evalCommand)
83+
];
4984
}
5085
else action
5186
)

0 commit comments

Comments
 (0)