Skip to content

Commit a1ef840

Browse files
committed
tests: make bt-blocktypes snapshot test less flaky
1 parent f6caa61 commit a1ef840

File tree

4 files changed

+58
-50
lines changed

4 files changed

+58
-50
lines changed

src/local/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/tests/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.

tests/_snapshots/bt-blocktypes

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
command = <derivation build>;
4747
description = "build it";
4848
name = "build";
49-
proviso = /nix/store/gxak6rzyi0qrk609bnrxjqmn7ain9h8f-incl/std/fwlib/actions/build-proviso.sh;
49+
proviso = "std/fwlib/actions/build-proviso.sh";
5050
targetDrv = "drvPath";
5151
}
5252
{
@@ -61,7 +61,7 @@
6161
image = "repo:tag";
6262
};
6363
name = "publish";
64-
proviso = /nix/store/gxak6rzyi0qrk609bnrxjqmn7ain9h8f-incl/std/fwlib/blockTypes/containers-proviso.sh;
64+
proviso = "std/fwlib/blockTypes/containers-proviso.sh";
6565
}
6666
{
6767
command = <derivation load>;
@@ -94,7 +94,7 @@
9494
command = <derivation build>;
9595
description = "build it";
9696
name = "build";
97-
proviso = /nix/store/gxak6rzyi0qrk609bnrxjqmn7ain9h8f-incl/std/fwlib/actions/build-proviso.sh;
97+
proviso = "std/fwlib/actions/build-proviso.sh";
9898
targetDrv = "drvPath";
9999
}
100100
{
@@ -127,7 +127,7 @@
127127
command = <derivation build>;
128128
description = "build it";
129129
name = "build";
130-
proviso = /nix/store/gxak6rzyi0qrk609bnrxjqmn7ain9h8f-incl/std/fwlib/actions/build-proviso.sh;
130+
proviso = "std/fwlib/actions/build-proviso.sh";
131131
targetDrv = "drvPath";
132132
}
133133
{
@@ -280,7 +280,7 @@
280280
command = <derivation build>;
281281
description = "build it";
282282
name = "build";
283-
proviso = /nix/store/gxak6rzyi0qrk609bnrxjqmn7ain9h8f-incl/std/fwlib/actions/build-proviso.sh;
283+
proviso = "std/fwlib/actions/build-proviso.sh";
284284
targetDrv = "drvPath";
285285
}
286286
{

tests/bt-blocktypes/expr.nix

Lines changed: 47 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,52 @@
22
inputs,
33
std,
44
flake-parts,
5-
}:
6-
builtins.mapAttrs (
7-
n: f: let
8-
action = builtins.removeAttrs ({
9-
terra = f n "myrepo";
10-
}
11-
.${n}
12-
or (f n)) ["__functor"];
13-
buildable = {drvPath = "drvPath";};
14-
targets = {
15-
runnables = buildable;
16-
installables = buildable;
17-
devshells = buildable;
18-
containers =
19-
buildable
20-
// {
21-
image = {
22-
name = "repo:tag";
23-
repo = "repo";
24-
tag = "tag";
25-
tags = ["tag" "tag2"];
5+
nixpkgs,
6+
}: let
7+
inherit (builtins) mapAttrs concatStringsSep;
8+
inherit (nixpkgs.lib) splitString drop;
9+
trimProvisoPath = a:
10+
if a ? proviso
11+
then a // {proviso = concatStringsSep "/" (drop 4 (splitString "/" a.proviso));}
12+
else a;
13+
in
14+
mapAttrs (
15+
n: f: let
16+
action = builtins.removeAttrs ({
17+
terra = f n "myrepo";
18+
}
19+
.${n}
20+
or (f n)) ["__functor"];
21+
buildable = {drvPath = "drvPath";};
22+
targets = {
23+
runnables = buildable;
24+
installables = buildable;
25+
devshells = buildable;
26+
containers =
27+
buildable
28+
// {
29+
image = {
30+
name = "repo:tag";
31+
repo = "repo";
32+
tag = "tag";
33+
tags = ["tag" "tag2"];
34+
};
2635
};
27-
};
28-
};
29-
in (
30-
if action ? actions
31-
then
32-
action
33-
// {
34-
actions = action.actions {
35-
inherit inputs;
36-
currentSystem = inputs.nixpkgs.system;
37-
fragment = "f.r.a.g.m.e.n.t";
38-
fragmentRelPath = "x86/f/r/a/g/m/e/n/t";
39-
target = targets.${n} or {};
40-
};
41-
}
42-
else action
36+
};
37+
in (
38+
if action ? actions
39+
then
40+
action
41+
// {
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+
});
49+
}
50+
else action
51+
)
4352
)
44-
)
45-
std.blockTypes
53+
std.blockTypes

0 commit comments

Comments
 (0)