Skip to content

Commit 6c68fbd

Browse files
committed
tests: refactor to carry the package set as an argument
This way, the package set will be possible to pass without re-importing all the time
1 parent 921b631 commit 6c68fbd

26 files changed

Lines changed: 134 additions & 54 deletions

nixos/lib/build-vms.nix

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
{ system, minimal ? false, config ? {} }:
2-
3-
let pkgs = import ../.. { inherit system config; }; in
1+
{ system, pkgs, minimal ? false, config ? {} }:
42

53
with pkgs.lib;
64
with import ../lib/qemu-flags.nix { inherit pkgs; };

nixos/lib/testing.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
{ system, minimal ? false, config ? {} }:
1+
{ system, pkgs, minimal ? false, config ? {} }:
22

3-
with import ./build-vms.nix { inherit system minimal config; };
3+
with import ./build-vms.nix { inherit system pkgs minimal config; };
44
with pkgs;
55

66
let
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
{ system ? builtins.currentSystem
2+
, config ? {}
23
, networkExpr
34
}:
45

56
let nodes = import networkExpr; in
67

7-
with import ../../../../lib/testing.nix { inherit system; };
8+
with import ../../../../lib/testing.nix {
9+
inherit system;
10+
pkgs = import ../.. { inherit system config; }
11+
};
812

913
(makeTest { inherit nodes; testScript = ""; }).driver

nixos/tests/boot.nix

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
{ system ? builtins.currentSystem }:
1+
{ system ? builtins.currentSystem,
2+
config ? {},
3+
pkgs ? import ../.. { inherit system config; }
4+
}:
25

3-
with import ../lib/testing.nix { inherit system; };
6+
with import ../lib/testing.nix { inherit system pkgs; };
47
with pkgs.lib;
58

69
let

nixos/tests/buildbot.nix

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
{ system ? builtins.currentSystem }:
1+
{ system ? builtins.currentSystem,
2+
config ? {},
3+
pkgs ? import ../.. { inherit system config; }
4+
}:
25

3-
with import ../lib/testing.nix { inherit system; };
6+
with import ../lib/testing.nix { inherit system pkgs; };
47

58
let
69
# Test ensures buildbot master comes up correctly and workers can connect

nixos/tests/certmgr.nix

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
{ system ? builtins.currentSystem }:
1+
{ system ? builtins.currentSystem,
2+
config ? {},
3+
pkgs ? import ../.. { inherit system config; }
4+
}:
25

3-
with import ../lib/testing.nix { inherit system; };
6+
with import ../lib/testing.nix { inherit system pkgs; };
47
let
58
mkSpec = { host, service ? null, action }: {
69
inherit action;

nixos/tests/chromium.nix

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{ system ? builtins.currentSystem
2-
, pkgs ? import ../.. { inherit system; }
2+
, config ? {}
3+
, pkgs ? import ../.. { inherit system config; }
34
, channelMap ? {
45
stable = pkgs.chromium;
56
beta = pkgs.chromiumBeta;
67
dev = pkgs.chromiumDev;
78
}
89
}:
910

10-
with import ../lib/testing.nix { inherit system; };
11+
with import ../lib/testing.nix { inherit system pkgs; };
1112
with pkgs.lib;
1213

1314
mapAttrs (channel: chromiumPkg: makeTest rec {

nixos/tests/cloud-init.nix

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
{ system ? builtins.currentSystem }:
1+
{ system ? builtins.currentSystem,
2+
config ? {},
3+
pkgs ? import ../.. { inherit system config; }
4+
}:
25

3-
with import ../lib/testing.nix { inherit system; };
6+
with import ../lib/testing.nix { inherit system pkgs; };
47
with pkgs.lib;
58

69
let

nixos/tests/ec2.nix

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
{ system ? builtins.currentSystem }:
1+
{ system ? builtins.currentSystem,
2+
config ? {},
3+
pkgs ? import ../.. { inherit system config; }
4+
}:
25

3-
with import ../lib/testing.nix { inherit system; };
6+
with import ../lib/testing.nix { inherit system pkgs; };
47
with pkgs.lib;
58

69
let

nixos/tests/elk.nix

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
{ system ? builtins.currentSystem, enableUnfree ? false }:
2-
with import ../lib/testing.nix { inherit system; };
1+
{ system ? builtins.currentSystem,
2+
config ? {},
3+
pkgs ? import ../.. { inherit system config; },
4+
enableUnfree ? false
5+
}:
6+
7+
with import ../lib/testing.nix { inherit system pkgs; };
38
with pkgs.lib;
9+
410
let
511
esUrl = "http://localhost:9200";
612

0 commit comments

Comments
 (0)