diff --git a/tests/integration/common.nix b/tests/integration/common.nix index 6a1000e..1ebedca 100644 --- a/tests/integration/common.nix +++ b/tests/integration/common.nix @@ -12,14 +12,17 @@ let 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 # one defined in disnixos fails the name attribute not correctly set # in the call to simpleTest. The only difference between this # function and the one in disnixos is the additional `inherit name` # line. - disnixTest = system: + customDisnixTest = system: {name, manifest, tarball, networkFile, externalNetworkFile ? false, testScript, dysnomiaStateDir ? "", postActivateTimeout ? 1}: let @@ -42,4 +45,24 @@ in 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; + }); } diff --git a/tests/integration/keycloak.nix b/tests/integration/keycloak.nix index 334c3fd..39ca02d 100644 --- a/tests/integration/keycloak.nix +++ b/tests/integration/keycloak.nix @@ -1,3 +1,4 @@ +# Run tests with nix-build -A tests.integration.keycloak { nixpkgs ? , systems ? [ "i686-linux" "x86_64-linux" ] }: @@ -5,13 +6,9 @@ let pkgs = import nixpkgs {}; - disnixos = import "${pkgs.disnixos}/share/disnixos/testing.nix" { - inherit nixpkgs; - }; - version = "1.0"; - disnixos2 = pkgs.callPackage ./common.nix { inherit nixpkgs; }; + disnixos = pkgs.callPackage ./common.nix { inherit nixpkgs; }; in rec { @@ -23,33 +20,23 @@ rec { }; builds = { - simple = 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 { - name = "test-project-manifest"; - inherit version; - inherit tarball; - servicesFile = "tests/integration/keycloak/services.nix"; - networkFile = "tests/integration/keycloak/network.nix"; - distributionFile = "tests/integration/keycloak/distribution.nix"; - # extraParams = { - # "extra-builtins-file" = ../../extra-builtins.nix; - # }; - } - ); + simple = disnixos.genBuilds systems { + name = "test-project-manifest"; + inherit version; + inherit tarball; + servicesFile = "tests/integration/keycloak/services.nix"; + networkFile = "tests/integration/keycloak/network.nix"; + distributionFile = "tests/integration/keycloak/distribution.nix"; + # extraParams = { + # "extra-builtins-file" = ../../extra-builtins.nix; + # }; + }; }; tests = { - simple = disnixos2.disnixTest builtins.currentSystem { + simple = disnixos.disnixTest builtins.currentSystem builds.simple { name = "test-project-test"; inherit tarball; - manifest = builtins.getAttr (builtins.currentSystem) builds.simple; networkFile = "tests/integration/keycloak/network.nix"; # dysnomiaStateDir = /var/state/dysnomia; testScript =