diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/functional/common/vars-and-functions.sh.in | 14 | ||||
-rw-r--r-- | tests/functional/flakes/flake-registry.sh | 3 | ||||
-rw-r--r-- | tests/nixos/default.nix | 38 | ||||
-rw-r--r-- | tests/nixos/nix-upgrade-nix.nix | 4 |
4 files changed, 14 insertions, 45 deletions
diff --git a/tests/functional/common/vars-and-functions.sh.in b/tests/functional/common/vars-and-functions.sh.in index bd1990973..bfc4fbc44 100644 --- a/tests/functional/common/vars-and-functions.sh.in +++ b/tests/functional/common/vars-and-functions.sh.in @@ -144,11 +144,15 @@ if [[ $(uname) == Linux ]] && [[ -L /proc/self/ns/user ]] && unshare --user true fi isDaemonNewer () { - [[ -n "${NIX_DAEMON_PACKAGE:-}" ]] || return 0 - local requiredVersion="$1" - local versionOutput=$($NIX_DAEMON_PACKAGE/bin/nix daemon --version) - local daemonVersion=${versionOutput##* } - [[ $(nix eval --expr "builtins.compareVersions ''$daemonVersion'' ''$requiredVersion''") -ge 0 ]] + [[ -n "${NIX_DAEMON_PACKAGE:-}" ]] || return 0 + local requiredVersion="$1" + local versionOutput + versionOutput=$("$NIX_DAEMON_PACKAGE/bin/nix" daemon --version) + local daemonVersion=${versionOutput##* } + if [[ ! $daemonVersion =~ [[:digit:]]+\.[[:digit:]]+\..* ]]; then + fail "Daemon version '$daemonVersion' does not look plausible, this is a testsuite bug!" + fi + [[ $(nix eval --expr "builtins.compareVersions ''$daemonVersion'' ''$requiredVersion''") -ge 0 ]] } skipTest () { diff --git a/tests/functional/flakes/flake-registry.sh b/tests/functional/flakes/flake-registry.sh index 73ab353bf..5e72bd05a 100644 --- a/tests/functional/flakes/flake-registry.sh +++ b/tests/functional/flakes/flake-registry.sh @@ -22,6 +22,7 @@ nix registry list | grep '^global flake:home-manager' set -m # port 0: auto pick a free port, unbufferred output python3 -u -m http.server 0 --bind 127.0.0.1 > server.out & + # wait for the http server to admit it is working while ! grep -qP 'port \d+' server.out ; do echo 'waiting for python http' >&2 @@ -69,4 +70,4 @@ nix registry list | grep '^global flake:private-flake' # make sure we have a warning: nix registry list 2>&1 | grep "config option flake-registry referring to a URL is deprecated and will be removed" -kill %1 +kill %python diff --git a/tests/nixos/default.nix b/tests/nixos/default.nix index 5e8bc69ce..301eede46 100644 --- a/tests/nixos/default.nix +++ b/tests/nixos/default.nix @@ -33,7 +33,7 @@ let checkOverrideNixVersion = { pkgs, lib, ... }: { # pkgs.nix: The new Nix in this repo # We disallow it, to make sure we don't accidentally use it. - system.forbiddenDependenciesRegex = lib.strings.escapeRegex "nix-${pkgs.nix.version}"; + system.forbiddenDependenciesRegexes = [ (lib.strings.escapeRegex "nix-${pkgs.nix.version}") ]; }; in @@ -53,15 +53,6 @@ in }; }; - remoteBuilds_remote_2_13 = runNixOSTestFor "x86_64-linux" ({ lib, pkgs, ... }: { - name = "remoteBuilds_remote_2_13"; - imports = [ ./remote-builds.nix ]; - builders.config = { lib, pkgs, ... }: { - imports = [ checkOverrideNixVersion ]; - nix.package = lib.mkForce pkgs.nixVersions.nix_2_13; - }; - }); - remoteBuilds_remote_2_18 = runNixOSTestFor "x86_64-linux" ({ lib, pkgs, ... }: { name = "remoteBuilds_remote_2_18"; imports = [ ./remote-builds.nix ]; @@ -82,15 +73,6 @@ in }; }); - remoteBuilds_local_2_13 = runNixOSTestFor "x86_64-linux" ({ lib, pkgs, ... }: { - name = "remoteBuilds_local_2_13"; - imports = [ ./remote-builds.nix ]; - nodes.client = { lib, pkgs, ... }: { - imports = [ checkOverrideNixVersion ]; - nix.package = lib.mkForce pkgs.nixVersions.nix_2_13; - }; - }); - remoteBuilds_local_2_18 = runNixOSTestFor "x86_64-linux" ({ lib, pkgs, ... }: { name = "remoteBuilds_local_2_18"; imports = [ ./remote-builds.nix ]; @@ -115,15 +97,6 @@ in }; }; - remoteBuildsSshNg_remote_2_13 = runNixOSTestFor "x86_64-linux" { - name = "remoteBuildsSshNg_remote_2_13"; - imports = [ ./remote-builds-ssh-ng.nix ]; - builders.config = { lib, pkgs, ... }: { - imports = [ checkOverrideNixVersion ]; - nix.package = lib.mkForce pkgs.nixVersions.nix_2_13; - }; - }; - remoteBuildsSshNg_remote_2_18 = runNixOSTestFor "x86_64-linux" { name = "remoteBuildsSshNg_remote_2_18"; imports = [ ./remote-builds-ssh-ng.nix ]; @@ -146,15 +119,6 @@ in }; }); - remoteBuildsSshNg_local_2_13 = runNixOSTestFor "x86_64-linux" ({ lib, pkgs, ... }: { - name = "remoteBuildsSshNg_local_2_13"; - imports = [ ./remote-builds-ssh-ng.nix ]; - nodes.client = { lib, pkgs, ... }: { - imports = [ checkOverrideNixVersion ]; - nix.package = lib.mkForce pkgs.nixVersions.nix_2_13; - }; - }); - # TODO: (nixpkgs update) remoteBuildsSshNg_local_2_18 = ... */ diff --git a/tests/nixos/nix-upgrade-nix.nix b/tests/nixos/nix-upgrade-nix.nix index 039b2d9b3..acccc2e03 100644 --- a/tests/nixos/nix-upgrade-nix.nix +++ b/tests/nixos/nix-upgrade-nix.nix @@ -11,7 +11,7 @@ let lix = pkgs.nix; lixVersion = lib.getVersion lix; - newNix = pkgs.nixVersions.unstable; + newNix = pkgs.nixVersions.latest; newNixVersion = lib.getVersion newNix; in { @@ -20,7 +20,7 @@ in { nodes = { machine = { config, lib, pkgs, ... }: { virtualisation.writableStore = true; - virtualisation.additionalPaths = [ pkgs.hello.drvPath ]; + virtualisation.additionalPaths = [ pkgs.hello.drvPath newNix ]; nix.settings.substituters = lib.mkForce [ ]; nix.settings.experimental-features = [ "nix-command" "flakes" ]; services.getty.autologinUser = "root"; |