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
This commit is contained in:
Léo Gaspard 2018-11-11 17:41:11 +09:00
parent 921b63134a
commit 6c68fbd4e1
No known key found for this signature in database
GPG key ID: 8A55848B6090F9CF
26 changed files with 133 additions and 53 deletions

View file

@ -1,6 +1,4 @@
{ system, minimal ? false, config ? {} }: { system, pkgs, minimal ? false, config ? {} }:
let pkgs = import ../.. { inherit system config; }; in
with pkgs.lib; with pkgs.lib;
with import ../lib/qemu-flags.nix { inherit pkgs; }; with import ../lib/qemu-flags.nix { inherit pkgs; };

View file

@ -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; with pkgs;
let let

View file

@ -1,9 +1,13 @@
{ system ? builtins.currentSystem { system ? builtins.currentSystem
, config ? {}
, networkExpr , networkExpr
}: }:
let nodes = import networkExpr; in 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 (makeTest { inherit nodes; testScript = ""; }).driver

View file

@ -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; with pkgs.lib;
let let

View file

@ -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 let
# Test ensures buildbot master comes up correctly and workers can connect # Test ensures buildbot master comes up correctly and workers can connect

View file

@ -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 let
mkSpec = { host, service ? null, action }: { mkSpec = { host, service ? null, action }: {
inherit action; inherit action;

View file

@ -1,5 +1,6 @@
{ system ? builtins.currentSystem { system ? builtins.currentSystem
, pkgs ? import ../.. { inherit system; } , config ? {}
, pkgs ? import ../.. { inherit system config; }
, channelMap ? { , channelMap ? {
stable = pkgs.chromium; stable = pkgs.chromium;
beta = pkgs.chromiumBeta; 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; with pkgs.lib;
mapAttrs (channel: chromiumPkg: makeTest rec { mapAttrs (channel: chromiumPkg: makeTest rec {

View file

@ -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; with pkgs.lib;
let let

View file

@ -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; with pkgs.lib;
let let

View file

@ -1,6 +1,12 @@
{ system ? builtins.currentSystem, enableUnfree ? false }: { system ? builtins.currentSystem,
with import ../lib/testing.nix { inherit system; }; config ? {},
pkgs ? import ../.. { inherit system config; },
enableUnfree ? false
}:
with import ../lib/testing.nix { inherit system pkgs; };
with pkgs.lib; with pkgs.lib;
let let
esUrl = "http://localhost:9200"; esUrl = "http://localhost:9200";

View file

@ -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; with pkgs.lib;
{ {

View file

@ -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; with pkgs.lib;
let let

View file

@ -1,5 +1,9 @@
{ system ? builtins.currentSystem }: { system ? builtins.currentSystem,
with import ../lib/testing.nix { inherit system; }; config ? {},
pkgs ? import ../.. { inherit system config; }
}:
with import ../lib/testing.nix { inherit system pkgs; };
with pkgs.lib; with pkgs.lib;
let let

View file

@ -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 let
readyFile = "/tmp/readerReady"; readyFile = "/tmp/readerReady";

View file

@ -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; with pkgs.lib;
let let

View file

@ -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) makeTest (if pkgs.lib.isFunction f then f (args // { inherit pkgs; inherit (pkgs) lib; }) else f)

View file

@ -1,8 +1,10 @@
{ system ? builtins.currentSystem { system ? builtins.currentSystem
, config ? {}
, pkgs ? import ../.. { inherit system config; },
# bool: whether to use networkd in the tests # bool: whether to use networkd in the tests
, networkd }: , networkd }:
with import ../lib/testing.nix { inherit system; }; with import ../lib/testing.nix { inherit system pkgs; };
with pkgs.lib; with pkgs.lib;
let let

View file

@ -1,6 +1,9 @@
{ system ? builtins.currentSystem }: { system ? builtins.currentSystem,
config ? {},
pkgs ? import ../../.. { inherit system config; }
}:
{ {
basic = import ./basic.nix { inherit system; }; basic = import ./basic.nix { inherit system pkgs; };
with-postgresql-and-redis = import ./with-postgresql-and-redis.nix { inherit system; }; 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; }; with-mysql-and-memcached = import ./with-mysql-and-memcached.nix { inherit system pkgs; };
} }

View file

@ -1,6 +1,11 @@
{ system ? builtins.currentSystem }: { system ? builtins.currentSystem,
with import ../lib/testing.nix { inherit system; }; config ? {},
pkgs ? import ../.. { inherit system config; }
}:
with import ../lib/testing.nix { inherit system pkgs; };
with pkgs.lib; with pkgs.lib;
let let
postgresql-versions = pkgs.callPackages ../../pkgs/servers/sql/postgresql { }; postgresql-versions = pkgs.callPackages ../../pkgs/servers/sql/postgresql { };
test-sql = pkgs.writeText "postgresql-test" '' test-sql = pkgs.writeText "postgresql-test" ''

View file

@ -1,7 +1,10 @@
{ system ? builtins.currentSystem }: { system ? builtins.currentSystem,
config ? {},
pkgs ? import ../.. { inherit system config; }
}:
let 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: { in pkgs.lib.listToAttrs (pkgs.lib.crossLists (predictable: withNetworkd: {
name = pkgs.lib.optionalString (!predictable) "un" + "predictable" name = pkgs.lib.optionalString (!predictable) "un" + "predictable"
+ pkgs.lib.optionalString withNetworkd "Networkd"; + pkgs.lib.optionalString withNetworkd "Networkd";

View file

@ -1,6 +1,11 @@
{ system ? builtins.currentSystem }: { system ? builtins.currentSystem,
with import ../lib/testing.nix { inherit system; }; config ? {},
pkgs ? import ../.. { inherit system config; }
}:
with import ../lib/testing.nix { inherit system pkgs; };
with pkgs.lib; with pkgs.lib;
let let
initMachine = '' initMachine = ''
startAll startAll

View file

@ -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; with pkgs.lib;
{ {
test1 = makeTest { test1 = makeTest {
name = "rsyslogd-test1"; name = "rsyslogd-test1";

View file

@ -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 let
output = runInMachine { output = runInMachine {

View file

@ -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 let
inherit (pkgs) lib; inherit (pkgs) lib;

View file

@ -1,6 +1,11 @@
{ system ? builtins.currentSystem, debug ? false, enableUnfree ? false }: { system ? builtins.currentSystem,
config ? {},
pkgs ? import ../.. { inherit system config; },
debug ? false,
enableUnfree ? false
}:
with import ../lib/testing.nix { inherit system; }; with import ../lib/testing.nix { inherit system pkgs; };
with pkgs.lib; with pkgs.lib;
let let

View file

@ -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 let