refactor tests to remove boilerplate
This commit is contained in:
parent
ef7d2d2dd5
commit
130915784e
2 changed files with 40 additions and 30 deletions
|
@ -12,14 +12,17 @@ let
|
||||||
tar xfvj ${tarball}/tarballs/*.tar.bz2 --strip-components=1
|
tar xfvj ${tarball}/tarballs/*.tar.bz2 --strip-components=1
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
|
||||||
{
|
disnixos = import "${pkgs.disnixos}/share/disnixos/testing.nix" {
|
||||||
|
inherit nixpkgs;
|
||||||
|
};
|
||||||
|
|
||||||
# We need this function because, for a reason that eludes me, the
|
# We need this function because, for a reason that eludes me, the
|
||||||
# one defined in disnixos fails the name attribute not correctly set
|
# one defined in disnixos fails the name attribute not correctly set
|
||||||
# in the call to simpleTest. The only difference between this
|
# in the call to simpleTest. The only difference between this
|
||||||
# function and the one in disnixos is the additional `inherit name`
|
# function and the one in disnixos is the additional `inherit name`
|
||||||
# line.
|
# line.
|
||||||
disnixTest = system:
|
customDisnixTest = system:
|
||||||
{name, manifest, tarball, networkFile, externalNetworkFile ? false, testScript, dysnomiaStateDir ? "", postActivateTimeout ? 1}:
|
{name, manifest, tarball, networkFile, externalNetworkFile ? false, testScript, dysnomiaStateDir ? "", postActivateTimeout ? 1}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -42,4 +45,24 @@ in
|
||||||
manifestFile = "${manifest}/manifest.xml";
|
manifestFile = "${manifest}/manifest.xml";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
inherit (disnixos) sourceTarball;
|
||||||
|
|
||||||
|
genBuilds = systems: config:
|
||||||
|
pkgs.lib.genAttrs systems (system:
|
||||||
|
let
|
||||||
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
|
||||||
|
disnixos = import "${pkgs.disnixos}/share/disnixos/testing.nix" {
|
||||||
|
inherit nixpkgs system;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
disnixos.buildManifest config
|
||||||
|
);
|
||||||
|
|
||||||
|
disnixTest = currentSystem: manifest: config:
|
||||||
|
customDisnixTest currentSystem (config // {
|
||||||
|
manifest = builtins.getAttr currentSystem manifest;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# Run tests with nix-build -A tests.integration.keycloak
|
||||||
{ nixpkgs ? <nixpkgs>
|
{ nixpkgs ? <nixpkgs>
|
||||||
, systems ? [ "i686-linux" "x86_64-linux" ]
|
, systems ? [ "i686-linux" "x86_64-linux" ]
|
||||||
}:
|
}:
|
||||||
|
@ -5,13 +6,9 @@
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs {};
|
pkgs = import nixpkgs {};
|
||||||
|
|
||||||
disnixos = import "${pkgs.disnixos}/share/disnixos/testing.nix" {
|
|
||||||
inherit nixpkgs;
|
|
||||||
};
|
|
||||||
|
|
||||||
version = "1.0";
|
version = "1.0";
|
||||||
|
|
||||||
disnixos2 = pkgs.callPackage ./common.nix { inherit nixpkgs; };
|
disnixos = pkgs.callPackage ./common.nix { inherit nixpkgs; };
|
||||||
in
|
in
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
|
@ -23,15 +20,7 @@ rec {
|
||||||
};
|
};
|
||||||
|
|
||||||
builds = {
|
builds = {
|
||||||
simple = pkgs.lib.genAttrs systems (system:
|
simple = disnixos.genBuilds systems {
|
||||||
let
|
|
||||||
pkgs = import nixpkgs { inherit system; };
|
|
||||||
|
|
||||||
disnixos = import "${pkgs.disnixos}/share/disnixos/testing.nix" {
|
|
||||||
inherit nixpkgs system;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
disnixos.buildManifest {
|
|
||||||
name = "test-project-manifest";
|
name = "test-project-manifest";
|
||||||
inherit version;
|
inherit version;
|
||||||
inherit tarball;
|
inherit tarball;
|
||||||
|
@ -41,15 +30,13 @@ rec {
|
||||||
# extraParams = {
|
# extraParams = {
|
||||||
# "extra-builtins-file" = ../../extra-builtins.nix;
|
# "extra-builtins-file" = ../../extra-builtins.nix;
|
||||||
# };
|
# };
|
||||||
}
|
};
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
tests = {
|
tests = {
|
||||||
simple = disnixos2.disnixTest builtins.currentSystem {
|
simple = disnixos.disnixTest builtins.currentSystem builds.simple {
|
||||||
name = "test-project-test";
|
name = "test-project-test";
|
||||||
inherit tarball;
|
inherit tarball;
|
||||||
manifest = builtins.getAttr (builtins.currentSystem) builds.simple;
|
|
||||||
networkFile = "tests/integration/keycloak/network.nix";
|
networkFile = "tests/integration/keycloak/network.nix";
|
||||||
# dysnomiaStateDir = /var/state/dysnomia;
|
# dysnomiaStateDir = /var/state/dysnomia;
|
||||||
testScript =
|
testScript =
|
||||||
|
|
Loading…
Reference in a new issue