summary refs log tree commit diff
diff options
context:
space:
mode:
authorLéo Gaspard <leo@gaspard.io>2018-11-11 17:41:11 +0900
committerLéo Gaspard <leo@gaspard.io>2018-11-11 23:11:45 +0900
commit6c68fbd4e1f8beac39cb1f499ff90c78256262d6 (patch)
treeaac6a33afe1ed7f4ebf408cc83903ea8a66531da
parent921b63134a0181533b3673a48f96bb3b75ac3a9f (diff)
downloadnixpkgs-6c68fbd4e1f8beac39cb1f499ff90c78256262d6.tar
nixpkgs-6c68fbd4e1f8beac39cb1f499ff90c78256262d6.tar.gz
nixpkgs-6c68fbd4e1f8beac39cb1f499ff90c78256262d6.tar.bz2
nixpkgs-6c68fbd4e1f8beac39cb1f499ff90c78256262d6.tar.lz
nixpkgs-6c68fbd4e1f8beac39cb1f499ff90c78256262d6.tar.xz
nixpkgs-6c68fbd4e1f8beac39cb1f499ff90c78256262d6.tar.zst
nixpkgs-6c68fbd4e1f8beac39cb1f499ff90c78256262d6.zip
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
-rw-r--r--nixos/lib/build-vms.nix4
-rw-r--r--nixos/lib/testing.nix4
-rw-r--r--nixos/modules/installer/tools/nixos-build-vms/build-vms.nix6
-rw-r--r--nixos/tests/boot.nix7
-rw-r--r--nixos/tests/buildbot.nix7
-rw-r--r--nixos/tests/certmgr.nix7
-rw-r--r--nixos/tests/chromium.nix5
-rw-r--r--nixos/tests/cloud-init.nix7
-rw-r--r--nixos/tests/ec2.nix7
-rw-r--r--nixos/tests/elk.nix10
-rw-r--r--nixos/tests/gitea.nix7
-rw-r--r--nixos/tests/installer.nix7
-rw-r--r--nixos/tests/kafka.nix8
-rw-r--r--nixos/tests/keymap.nix7
-rw-r--r--nixos/tests/kubernetes/base.nix7
-rw-r--r--nixos/tests/make-test.nix8
-rw-r--r--nixos/tests/networking.nix4
-rw-r--r--nixos/tests/nextcloud/default.nix11
-rw-r--r--nixos/tests/postgresql.nix9
-rw-r--r--nixos/tests/predictable-interface-names.nix7
-rw-r--r--nixos/tests/rspamd.nix9
-rw-r--r--nixos/tests/rsyslogd.nix8
-rw-r--r--nixos/tests/run-in-machine.nix7
-rw-r--r--nixos/tests/sddm.nix7
-rw-r--r--nixos/tests/virtualbox.nix11
-rw-r--r--nixos/tests/zfs.nix7
26 files changed, 134 insertions, 54 deletions
diff --git a/nixos/lib/build-vms.nix b/nixos/lib/build-vms.nix
index 4f65501f89c..933f8139249 100644
--- a/nixos/lib/build-vms.nix
+++ b/nixos/lib/build-vms.nix
@@ -1,6 +1,4 @@
-{ system, minimal ? false, config ? {} }:
-
-let pkgs = import ../.. { inherit system config; }; in
+{ system, pkgs, minimal ? false, config ? {} }:
 
 with pkgs.lib;
 with import ../lib/qemu-flags.nix { inherit pkgs; };
diff --git a/nixos/lib/testing.nix b/nixos/lib/testing.nix
index 8cdf4150057..d26d4a91924 100644
--- a/nixos/lib/testing.nix
+++ b/nixos/lib/testing.nix
@@ -1,6 +1,6 @@
-{ system, minimal ? false, config ? {} }:
+{ system, pkgs, minimal ? false, config ? {} }:
 
-with import ./build-vms.nix { inherit system minimal config; };
+with import ./build-vms.nix { inherit system pkgs minimal config; };
 with pkgs;
 
 let
diff --git a/nixos/modules/installer/tools/nixos-build-vms/build-vms.nix b/nixos/modules/installer/tools/nixos-build-vms/build-vms.nix
index 4372d196261..4d6da849f23 100644
--- a/nixos/modules/installer/tools/nixos-build-vms/build-vms.nix
+++ b/nixos/modules/installer/tools/nixos-build-vms/build-vms.nix
@@ -1,9 +1,13 @@
 { system ? builtins.currentSystem
+, config ? {}
 , networkExpr
 }:
 
 let nodes = import networkExpr; in
 
-with import ../../../../lib/testing.nix { inherit system; };
+with import ../../../../lib/testing.nix {
+  inherit system;
+  pkgs = import ../.. { inherit system config; }
+};
 
 (makeTest { inherit nodes; testScript = ""; }).driver
diff --git a/nixos/tests/boot.nix b/nixos/tests/boot.nix
index 301d9d0f817..c9bb1e77c6d 100644
--- a/nixos/tests/boot.nix
+++ b/nixos/tests/boot.nix
@@ -1,6 +1,9 @@
-{ system ? builtins.currentSystem }:
+{ system ? builtins.currentSystem,
+  config ? {},
+  pkgs ? import ../.. { inherit system config; }
+}:
 
-with import ../lib/testing.nix { inherit system; };
+with import ../lib/testing.nix { inherit system pkgs; };
 with pkgs.lib;
 
 let
diff --git a/nixos/tests/buildbot.nix b/nixos/tests/buildbot.nix
index 399fd39005e..210ad8e91df 100644
--- a/nixos/tests/buildbot.nix
+++ b/nixos/tests/buildbot.nix
@@ -1,6 +1,9 @@
-{ system ? builtins.currentSystem }:
+{ system ? builtins.currentSystem,
+  config ? {},
+  pkgs ? import ../.. { inherit system config; }
+}:
 
-with import ../lib/testing.nix { inherit system; };
+with import ../lib/testing.nix { inherit system pkgs; };
 
 let
   # Test ensures buildbot master comes up correctly and workers can connect
diff --git a/nixos/tests/certmgr.nix b/nixos/tests/certmgr.nix
index 8354c46b85f..fe67833808c 100644
--- a/nixos/tests/certmgr.nix
+++ b/nixos/tests/certmgr.nix
@@ -1,6 +1,9 @@
-{ system ? builtins.currentSystem }:
+{ system ? builtins.currentSystem,
+  config ? {},
+  pkgs ? import ../.. { inherit system config; }
+}:
 
-with import ../lib/testing.nix { inherit system; };
+with import ../lib/testing.nix { inherit system pkgs; };
 let
   mkSpec = { host, service ? null, action }: {
     inherit action;
diff --git a/nixos/tests/chromium.nix b/nixos/tests/chromium.nix
index e5097609fb2..af5db2a3dbe 100644
--- a/nixos/tests/chromium.nix
+++ b/nixos/tests/chromium.nix
@@ -1,5 +1,6 @@
 { system ? builtins.currentSystem
-, pkgs ? import ../.. { inherit system; }
+, config ? {}
+, pkgs ? import ../.. { inherit system config; }
 , channelMap ? {
     stable = pkgs.chromium;
     beta   = pkgs.chromiumBeta;
@@ -7,7 +8,7 @@
   }
 }:
 
-with import ../lib/testing.nix { inherit system; };
+with import ../lib/testing.nix { inherit system pkgs; };
 with pkgs.lib;
 
 mapAttrs (channel: chromiumPkg: makeTest rec {
diff --git a/nixos/tests/cloud-init.nix b/nixos/tests/cloud-init.nix
index 303e7408646..516d29c9036 100644
--- a/nixos/tests/cloud-init.nix
+++ b/nixos/tests/cloud-init.nix
@@ -1,6 +1,9 @@
-{ system ? builtins.currentSystem }:
+{ system ? builtins.currentSystem,
+  config ? {},
+  pkgs ? import ../.. { inherit system config; }
+}:
 
-with import ../lib/testing.nix { inherit system; };
+with import ../lib/testing.nix { inherit system pkgs; };
 with pkgs.lib;
 
 let
diff --git a/nixos/tests/ec2.nix b/nixos/tests/ec2.nix
index 8271747ccc6..ed6bf7da988 100644
--- a/nixos/tests/ec2.nix
+++ b/nixos/tests/ec2.nix
@@ -1,6 +1,9 @@
-{ system ? builtins.currentSystem }:
+{ system ? builtins.currentSystem,
+  config ? {},
+  pkgs ? import ../.. { inherit system config; }
+}:
 
-with import ../lib/testing.nix { inherit system; };
+with import ../lib/testing.nix { inherit system pkgs; };
 with pkgs.lib;
 
 let
diff --git a/nixos/tests/elk.nix b/nixos/tests/elk.nix
index 15be72b80bb..d787ac97300 100644
--- a/nixos/tests/elk.nix
+++ b/nixos/tests/elk.nix
@@ -1,6 +1,12 @@
-{ system ? builtins.currentSystem, enableUnfree ? false }:
-with import ../lib/testing.nix { inherit system; };
+{ system ? builtins.currentSystem,
+  config ? {},
+  pkgs ? import ../.. { inherit system config; },
+  enableUnfree ? false
+}:
+
+with import ../lib/testing.nix { inherit system pkgs; };
 with pkgs.lib;
+
 let
   esUrl = "http://localhost:9200";
 
diff --git a/nixos/tests/gitea.nix b/nixos/tests/gitea.nix
index 7ffe05ef3f1..35433499185 100644
--- a/nixos/tests/gitea.nix
+++ b/nixos/tests/gitea.nix
@@ -1,6 +1,9 @@
-{ system ? builtins.currentSystem }:
+{ system ? builtins.currentSystem,
+  config ? {},
+  pkgs ? import ../.. { inherit system config; }
+}:
 
-with import ../lib/testing.nix { inherit system; };
+with import ../lib/testing.nix { inherit system pkgs; };
 with pkgs.lib;
 
 {
diff --git a/nixos/tests/installer.nix b/nixos/tests/installer.nix
index 3f9fa0e6016..e03fc459cb8 100644
--- a/nixos/tests/installer.nix
+++ b/nixos/tests/installer.nix
@@ -1,6 +1,9 @@
-{ system ? builtins.currentSystem }:
+{ system ? builtins.currentSystem,
+  config ? {},
+  pkgs ? import ../.. { inherit system config; }
+}:
 
-with import ../lib/testing.nix { inherit system; };
+with import ../lib/testing.nix { inherit system pkgs; };
 with pkgs.lib;
 
 let
diff --git a/nixos/tests/kafka.nix b/nixos/tests/kafka.nix
index c9fd74620ef..a833e01f9f5 100644
--- a/nixos/tests/kafka.nix
+++ b/nixos/tests/kafka.nix
@@ -1,5 +1,9 @@
-{ system ? builtins.currentSystem }:
-with import ../lib/testing.nix { inherit system; };
+{ system ? builtins.currentSystem,
+  config ? {},
+  pkgs ? import ../.. { inherit system config; }
+}:
+
+with import ../lib/testing.nix { inherit system pkgs; };
 with pkgs.lib;
 
 let
diff --git a/nixos/tests/keymap.nix b/nixos/tests/keymap.nix
index be880388314..b19da251119 100644
--- a/nixos/tests/keymap.nix
+++ b/nixos/tests/keymap.nix
@@ -1,6 +1,9 @@
-{ system ? builtins.currentSystem }:
+{ system ? builtins.currentSystem,
+  config ? {},
+  pkgs ? import ../.. { inherit system config; }
+}:
 
-with import ../lib/testing.nix { inherit system; };
+with import ../lib/testing.nix { inherit system pkgs; };
 
 let
   readyFile  = "/tmp/readerReady";
diff --git a/nixos/tests/kubernetes/base.nix b/nixos/tests/kubernetes/base.nix
index e4bc5b326d3..b77da3414b3 100644
--- a/nixos/tests/kubernetes/base.nix
+++ b/nixos/tests/kubernetes/base.nix
@@ -1,6 +1,9 @@
-{ system ? builtins.currentSystem }:
+{ system ? builtins.currentSystem,
+  config ? {},
+  pkgs ? import ../.. { inherit system config; }
+}:
 
-with import ../../lib/testing.nix { inherit system; };
+with import ../../lib/testing.nix { inherit system pkgs; };
 with pkgs.lib;
 
 let
diff --git a/nixos/tests/make-test.nix b/nixos/tests/make-test.nix
index ee4ba310ad5..cee5da93454 100644
--- a/nixos/tests/make-test.nix
+++ b/nixos/tests/make-test.nix
@@ -1,5 +1,9 @@
-f: { system ? builtins.currentSystem, ... } @ args:
+f: {
+  system ? builtins.currentSystem,
+  pkgs ? import ../.. { inherit system; config = {}; },
+  ...
+} @ args:
 
-with import ../lib/testing.nix { inherit system; };
+with import ../lib/testing.nix { inherit system pkgs; };
 
 makeTest (if pkgs.lib.isFunction f then f (args // { inherit pkgs; inherit (pkgs) lib; }) else f)
diff --git a/nixos/tests/networking.nix b/nixos/tests/networking.nix
index d1d4fd41dda..6843e8b2636 100644
--- a/nixos/tests/networking.nix
+++ b/nixos/tests/networking.nix
@@ -1,8 +1,10 @@
 { system ? builtins.currentSystem
+, config ? {}
+, pkgs ? import ../.. { inherit system config; },
 # bool: whether to use networkd in the tests
 , networkd }:
 
-with import ../lib/testing.nix { inherit system; };
+with import ../lib/testing.nix { inherit system pkgs; };
 with pkgs.lib;
 
 let
diff --git a/nixos/tests/nextcloud/default.nix b/nixos/tests/nextcloud/default.nix
index 66da6794b96..e4c7a70606c 100644
--- a/nixos/tests/nextcloud/default.nix
+++ b/nixos/tests/nextcloud/default.nix
@@ -1,6 +1,9 @@
-{ system ? builtins.currentSystem }:
+{ system ? builtins.currentSystem,
+  config ? {},
+  pkgs ? import ../../.. { inherit system config; }
+}:
 {
-  basic = import ./basic.nix { inherit system; };
-  with-postgresql-and-redis = import ./with-postgresql-and-redis.nix { inherit system; };
-  with-mysql-and-memcached = import ./with-mysql-and-memcached.nix { inherit system; };
+  basic = import ./basic.nix { inherit system pkgs; };
+  with-postgresql-and-redis = import ./with-postgresql-and-redis.nix { inherit system pkgs; };
+  with-mysql-and-memcached = import ./with-mysql-and-memcached.nix { inherit system pkgs; };
 }
diff --git a/nixos/tests/postgresql.nix b/nixos/tests/postgresql.nix
index f1f09277f34..ed54a31c8e5 100644
--- a/nixos/tests/postgresql.nix
+++ b/nixos/tests/postgresql.nix
@@ -1,6 +1,11 @@
-{ system ? builtins.currentSystem }:
-with import ../lib/testing.nix { inherit system; };
+{ system ? builtins.currentSystem,
+  config ? {},
+  pkgs ? import ../.. { inherit system config; }
+}:
+
+with import ../lib/testing.nix { inherit system pkgs; };
 with pkgs.lib;
+
 let
   postgresql-versions = pkgs.callPackages ../../pkgs/servers/sql/postgresql { };
   test-sql = pkgs.writeText "postgresql-test" ''
diff --git a/nixos/tests/predictable-interface-names.nix b/nixos/tests/predictable-interface-names.nix
index 0d73436c1c3..8306abb8c42 100644
--- a/nixos/tests/predictable-interface-names.nix
+++ b/nixos/tests/predictable-interface-names.nix
@@ -1,7 +1,10 @@
-{ system ? builtins.currentSystem }:
+{ system ? builtins.currentSystem,
+  config ? {},
+  pkgs ? import ../.. { inherit system config; }
+}:
 
 let
-  inherit (import ../lib/testing.nix { inherit system; }) makeTest pkgs;
+  inherit (import ../lib/testing.nix { inherit system pkgs; }) makeTest;
 in pkgs.lib.listToAttrs (pkgs.lib.crossLists (predictable: withNetworkd: {
   name = pkgs.lib.optionalString (!predictable) "un" + "predictable"
        + pkgs.lib.optionalString withNetworkd "Networkd";
diff --git a/nixos/tests/rspamd.nix b/nixos/tests/rspamd.nix
index c2175f1bc25..e16a9e6ffbc 100644
--- a/nixos/tests/rspamd.nix
+++ b/nixos/tests/rspamd.nix
@@ -1,6 +1,11 @@
-{ system ? builtins.currentSystem }:
-with import ../lib/testing.nix { inherit system; };
+{ system ? builtins.currentSystem,
+  config ? {},
+  pkgs ? import ../.. { inherit system config; }
+}:
+
+with import ../lib/testing.nix { inherit system pkgs; };
 with pkgs.lib;
+
 let
   initMachine = ''
     startAll
diff --git a/nixos/tests/rsyslogd.nix b/nixos/tests/rsyslogd.nix
index 969d59e0f2c..f17e61814c5 100644
--- a/nixos/tests/rsyslogd.nix
+++ b/nixos/tests/rsyslogd.nix
@@ -1,7 +1,11 @@
-{ system ? builtins.currentSystem }:
+{ system ? builtins.currentSystem,
+  config ? {},
+  pkgs ? import ../.. { inherit system config; }
+}:
 
-with import ../lib/testing.nix { inherit system; };
+with import ../lib/testing.nix { inherit system pkgs; };
 with pkgs.lib;
+
 {
   test1 = makeTest {
     name = "rsyslogd-test1";
diff --git a/nixos/tests/run-in-machine.nix b/nixos/tests/run-in-machine.nix
index bd90dc3080b..116f5dc28a6 100644
--- a/nixos/tests/run-in-machine.nix
+++ b/nixos/tests/run-in-machine.nix
@@ -1,6 +1,9 @@
-{ system ? builtins.currentSystem }:
+{ system ? builtins.currentSystem,
+  config ? {},
+  pkgs ? import ../.. { inherit system config; }
+}:
 
-with import ../lib/testing.nix { inherit system; };
+with import ../lib/testing.nix { inherit system pkgs; };
 
 let
   output = runInMachine {
diff --git a/nixos/tests/sddm.nix b/nixos/tests/sddm.nix
index 7b9fdc0b344..678bcbeab20 100644
--- a/nixos/tests/sddm.nix
+++ b/nixos/tests/sddm.nix
@@ -1,6 +1,9 @@
-{ system ? builtins.currentSystem }:
+{ system ? builtins.currentSystem,
+  config ? {},
+  pkgs ? import ../.. { inherit system config; }
+}:
 
-with import ../lib/testing.nix { inherit system; };
+with import ../lib/testing.nix { inherit system pkgs; };
 
 let
   inherit (pkgs) lib;
diff --git a/nixos/tests/virtualbox.nix b/nixos/tests/virtualbox.nix
index ce84576edca..385e2939fe3 100644
--- a/nixos/tests/virtualbox.nix
+++ b/nixos/tests/virtualbox.nix
@@ -1,6 +1,11 @@
-{ system ? builtins.currentSystem, debug ? false, enableUnfree ? false }:
-
-with import ../lib/testing.nix { inherit system; };
+{ system ? builtins.currentSystem,
+  config ? {},
+  pkgs ? import ../.. { inherit system config; },
+  debug ? false,
+  enableUnfree ? false
+}:
+
+with import ../lib/testing.nix { inherit system pkgs; };
 with pkgs.lib;
 
 let
diff --git a/nixos/tests/zfs.nix b/nixos/tests/zfs.nix
index 1434038e90c..d7a08268e98 100644
--- a/nixos/tests/zfs.nix
+++ b/nixos/tests/zfs.nix
@@ -1,6 +1,9 @@
-{ system ? builtins.currentSystem }:
+{ system ? builtins.currentSystem,
+  config ? {},
+  pkgs ? import ../.. { inherit system config; }
+}:
 
-with import ../lib/testing.nix { inherit system; };
+with import ../lib/testing.nix { inherit system pkgs; };
 
 let