Add curing vm tests (#312)
* add some additional vm tests * Wire things up * Add further tests * Fixups * Add more exhaustive default test check * Whoops fmt * Disable a currently breaking test * Repair notice content in CONTRIBUTING.md
This commit is contained in:
parent
385283173b
commit
f2437037f2
|
@ -196,9 +196,11 @@ nix build .#hydraJobs.vm-test.all.x86_64-linux.all -L
|
||||||
To run a specific distribution listed in the `nix flake show` output:
|
To run a specific distribution listed in the `nix flake show` output:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
nix build .#hydraJobs.vm-test.rhel-v7.x86_64-linux.all -L
|
nix build .#hydraJobs.vm-test.rhel-v7.x86_64-linux.all -L -j 4
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> You may wish to set `-j 4` to some other number. Some OS's (Ubuntu 16.04) exhibit problems rapidly updating their users/groups on a system running dozens of VMs.
|
||||||
|
|
||||||
For PR review, you can also test arbitrary branches or checkouts like so:
|
For PR review, you can also test arbitrary branches or checkouts like so:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -276,9 +278,7 @@ git+file:///home/ana/git/determinatesystems/nix-installer
|
||||||
|
|
||||||
To run all of the currently supported tests:
|
To run all of the currently supported tests:
|
||||||
|
|
||||||
```bash
|
> You may wish to set `-j 4` to some other number. Some OS's (Ubuntu 16.04) exhibit problems rapidly updating their users/groups on a system running dozens of VMs.
|
||||||
nix build .#hydraJobs.container-test.all.x86_64-linux.all -L
|
|
||||||
```
|
|
||||||
|
|
||||||
To run a specific distribution listed in the `nix flake show` output:
|
To run a specific distribution listed in the `nix flake show` output:
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
src = builtins.path {
|
src = builtins.path {
|
||||||
name = "nix-installer-source";
|
name = "nix-installer-source";
|
||||||
path = self;
|
path = self;
|
||||||
filter = (path: type: baseNameOf path != "nix" || baseNameOf path != ".github");
|
filter = (path: type: baseNameOf path != "nix" && baseNameOf path != ".github");
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = with final; [ ];
|
nativeBuildInputs = with final; [ ];
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
{ forSystem, binaryTarball }:
|
{ forSystem, binaryTarball }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
installScripts = rec {
|
||||||
installScripts = {
|
|
||||||
install-default = {
|
install-default = {
|
||||||
install = ''
|
install = ''
|
||||||
NIX_PATH=$(readlink -f nix.tar.xz)
|
NIX_PATH=$(readlink -f nix.tar.xz)
|
||||||
|
@ -12,6 +11,13 @@ let
|
||||||
check = ''
|
check = ''
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
|
if systemctl is-active nix-daemon.socket; then
|
||||||
|
echo "nix-daemon.socket was active"
|
||||||
|
else
|
||||||
|
echo "nix-daemon.socket was not active, should be"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
nix-env --version
|
nix-env --version
|
||||||
nix --extra-experimental-features nix-command store ping
|
nix --extra-experimental-features nix-command store ping
|
||||||
|
|
||||||
|
@ -35,13 +41,12 @@ let
|
||||||
echo "nix-daemon.service was running, should not be"
|
echo "nix-daemon.service was running, should not be"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo systemctl start nix-daemon.socket
|
sudo systemctl start nix-daemon.socket
|
||||||
|
|
||||||
nix-env --version
|
nix-env --version
|
||||||
nix --extra-experimental-features nix-command store ping
|
nix --extra-experimental-features nix-command store ping
|
||||||
|
|
||||||
out=$(nix-build --no-substitute -E 'derivation { name = "foo"; system = "x86_64-linux"; builder = "/bin/sh"; args = ["-c" "echo foobar > $out"]; }')
|
out=$(nix-build --no-substitute -E 'derivation { name = "foo"; system = "x86_64-linux"; builder = "/bin/sh"; args = ["-c" "echo foobar > $out"]; }')
|
||||||
|
|
||||||
[[ $(cat $out) = foobar ]]
|
[[ $(cat $out) = foobar ]]
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
@ -52,15 +57,76 @@ let
|
||||||
'';
|
'';
|
||||||
check = ''
|
check = ''
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
sudo -i nix-env --version
|
sudo -i nix-env --version
|
||||||
sudo -i nix --extra-experimental-features nix-command store ping
|
sudo -i nix --extra-experimental-features nix-command store ping
|
||||||
|
|
||||||
echo 'derivation { name = "foo"; system = "x86_64-linux"; builder = "/bin/sh"; args = ["-c" "echo foobar > $out"]; }' | sudo tee -a /drv
|
echo 'derivation { name = "foo"; system = "x86_64-linux"; builder = "/bin/sh"; args = ["-c" "echo foobar > $out"]; }' | sudo tee -a /drv
|
||||||
out=$(sudo -i nix-build --no-substitute /drv)
|
out=$(sudo -i nix-build --no-substitute /drv)
|
||||||
|
|
||||||
[[ $(cat $out) = foobar ]]
|
[[ $(cat $out) = foobar ]]
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
install-preexisting-self-working = {
|
||||||
|
preinstall = ''
|
||||||
|
NIX_PATH=$(readlink -f nix.tar.xz)
|
||||||
|
RUST_BACKTRACE="full" ./nix-installer install --nix-package-url "file://$NIX_PATH" --no-confirm
|
||||||
|
sudo mv /nix/receipt.json /nix/old-receipt.json
|
||||||
|
'';
|
||||||
|
install = install-default.install;
|
||||||
|
check = install-default.check;
|
||||||
|
};
|
||||||
|
# install-preexisting-self-broken-no-nix-path = {
|
||||||
|
# preinstall = ''
|
||||||
|
# NIX_PATH=$(readlink -f nix.tar.xz)
|
||||||
|
# RUST_BACKTRACE="full" ./nix-installer install --nix-package-url "file://$NIX_PATH" --no-confirm
|
||||||
|
# sudo mv /nix/receipt.json /nix/old-receipt.json
|
||||||
|
# sudo rm -rf /nix/
|
||||||
|
# '';
|
||||||
|
# install = install-default.install;
|
||||||
|
# check = install-default.check;
|
||||||
|
# };
|
||||||
|
install-preexisting-self-broken-missing-users = {
|
||||||
|
preinstall = ''
|
||||||
|
NIX_PATH=$(readlink -f nix.tar.xz)
|
||||||
|
RUST_BACKTRACE="full" ./nix-installer install --nix-package-url "file://$NIX_PATH" --no-confirm
|
||||||
|
sudo mv /nix/receipt.json /nix/old-receipt.json
|
||||||
|
sudo userdel nixbld1
|
||||||
|
sudo userdel nixbld3
|
||||||
|
sudo userdel nixbld16
|
||||||
|
'';
|
||||||
|
install = install-default.install;
|
||||||
|
check = install-default.check;
|
||||||
|
};
|
||||||
|
install-preexisting-self-broken-daemon-disabled = {
|
||||||
|
preinstall = ''
|
||||||
|
NIX_PATH=$(readlink -f nix.tar.xz)
|
||||||
|
RUST_BACKTRACE="full" ./nix-installer install --nix-package-url "file://$NIX_PATH" --no-confirm
|
||||||
|
sudo mv /nix/receipt.json /nix/old-receipt.json
|
||||||
|
sudo systemctl disable --now nix-daemon.socket
|
||||||
|
'';
|
||||||
|
install = install-default.install;
|
||||||
|
check = install-default.check;
|
||||||
|
};
|
||||||
|
install-preexisting-self-broken-no-etc-nix = {
|
||||||
|
preinstall = ''
|
||||||
|
NIX_PATH=$(readlink -f nix.tar.xz)
|
||||||
|
RUST_BACKTRACE="full" ./nix-installer install --nix-package-url "file://$NIX_PATH" --no-confirm
|
||||||
|
sudo mv /nix/receipt.json /nix/old-receipt.json
|
||||||
|
sudo rm -rf /etc/nix
|
||||||
|
'';
|
||||||
|
install = install-default.install;
|
||||||
|
check = install-default.check;
|
||||||
|
};
|
||||||
|
install-preexisting-self-broken-unmodified-bashrc = {
|
||||||
|
preinstall = ''
|
||||||
|
NIX_PATH=$(readlink -f nix.tar.xz)
|
||||||
|
RUST_BACKTRACE="full" ./nix-installer install --nix-package-url "file://$NIX_PATH" --no-confirm
|
||||||
|
sudo mv /nix/receipt.json /nix/old-receipt.json
|
||||||
|
sudo sed -i '/# Nix/,/# End Nix/d' /etc/bash.bashrc
|
||||||
|
'';
|
||||||
|
install = install-default.install;
|
||||||
|
check = install-default.check;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
disableSELinux = "sudo setenforce 0";
|
disableSELinux = "sudo setenforce 0";
|
||||||
|
@ -165,6 +231,7 @@ let
|
||||||
buildInputs = [ qemu_kvm openssh ];
|
buildInputs = [ qemu_kvm openssh ];
|
||||||
image = image.image;
|
image = image.image;
|
||||||
postBoot = image.postBoot or "";
|
postBoot = image.postBoot or "";
|
||||||
|
preinstallScript = installScripts.${testName}.preinstall or "echo \"Not Applicable\"";
|
||||||
installScript = installScripts.${testName}.install;
|
installScript = installScripts.${testName}.install;
|
||||||
checkScript = installScripts.${testName}.check;
|
checkScript = installScripts.${testName}.check;
|
||||||
installer = nix-installer-static;
|
installer = nix-installer-static;
|
||||||
|
@ -230,13 +297,16 @@ let
|
||||||
echo "Copying nix tarball..."
|
echo "Copying nix tarball..."
|
||||||
scp -P 20022 $ssh_opts $binaryTarball/nix-*.tar.xz vagrant@localhost:nix.tar.xz
|
scp -P 20022 $ssh_opts $binaryTarball/nix-*.tar.xz vagrant@localhost:nix.tar.xz
|
||||||
|
|
||||||
|
echo "Running preinstall..."
|
||||||
|
$ssh "set -eux; $preinstallScript"
|
||||||
|
|
||||||
echo "Running installer..."
|
echo "Running installer..."
|
||||||
$ssh "set -eux; $installScript"
|
$ssh "set -eux; $installScript"
|
||||||
|
|
||||||
echo "Testing Nix installation..."
|
echo "Testing Nix installation..."
|
||||||
$ssh "set -eux; $checkScript"
|
$ssh "set -eux; $checkScript"
|
||||||
|
|
||||||
echo "Testing Nix installation..."
|
echo "Testing Nix uninstallation..."
|
||||||
$ssh "set -eux; /nix/nix-installer uninstall --no-confirm"
|
$ssh "set -eux; /nix/nix-installer uninstall --no-confirm"
|
||||||
|
|
||||||
echo "Done!"
|
echo "Done!"
|
||||||
|
@ -280,12 +350,42 @@ vm-tests // rec {
|
||||||
name = "all";
|
name = "all";
|
||||||
constituents = pkgs.lib.mapAttrsToList (name: value: value."x86_64-linux".install-daemonless) vm-tests;
|
constituents = pkgs.lib.mapAttrsToList (name: value: value."x86_64-linux".install-daemonless) vm-tests;
|
||||||
});
|
});
|
||||||
|
all."x86_64-linux".install-preexisting-self-working = (with (forSystem "x86_64-linux" ({ system, pkgs, ... }: pkgs)); pkgs.releaseTools.aggregate {
|
||||||
|
name = "all";
|
||||||
|
constituents = pkgs.lib.mapAttrsToList (name: value: value."x86_64-linux".install-preexisting-self-working) vm-tests;
|
||||||
|
});
|
||||||
|
# all."x86_64-linux".install-preexisting-self-broken-no-nix-path = (with (forSystem "x86_64-linux" ({ system, pkgs, ... }: pkgs)); pkgs.releaseTools.aggregate {
|
||||||
|
# name = "all";
|
||||||
|
# constituents = pkgs.lib.mapAttrsToList (name: value: value."x86_64-linux".install-preexisting-self-broken-no-nix-path) vm-tests;
|
||||||
|
# });
|
||||||
|
all."x86_64-linux".install-preexisting-self-broken-missing-users = (with (forSystem "x86_64-linux" ({ system, pkgs, ... }: pkgs)); pkgs.releaseTools.aggregate {
|
||||||
|
name = "all";
|
||||||
|
constituents = pkgs.lib.mapAttrsToList (name: value: value."x86_64-linux".install-preexisting-self-broken-missing-users) vm-tests;
|
||||||
|
});
|
||||||
|
all."x86_64-linux".install-preexisting-self-broken-daemon-disabled = (with (forSystem "x86_64-linux" ({ system, pkgs, ... }: pkgs)); pkgs.releaseTools.aggregate {
|
||||||
|
name = "all";
|
||||||
|
constituents = pkgs.lib.mapAttrsToList (name: value: value."x86_64-linux".install-preexisting-self-broken-daemon-disabled) vm-tests;
|
||||||
|
});
|
||||||
|
all."x86_64-linux".install-preexisting-self-broken-no-etc-nix = (with (forSystem "x86_64-linux" ({ system, pkgs, ... }: pkgs)); pkgs.releaseTools.aggregate {
|
||||||
|
name = "all";
|
||||||
|
constituents = pkgs.lib.mapAttrsToList (name: value: value."x86_64-linux".install-preexisting-self-broken-no-etc-nix) vm-tests;
|
||||||
|
});
|
||||||
|
all."x86_64-linux".install-preexisting-self-broken-unmodified-bashrc = (with (forSystem "x86_64-linux" ({ system, pkgs, ... }: pkgs)); pkgs.releaseTools.aggregate {
|
||||||
|
name = "all";
|
||||||
|
constituents = pkgs.lib.mapAttrsToList (name: value: value."x86_64-linux".install-preexisting-self-broken-unmodified-bashrc) vm-tests;
|
||||||
|
});
|
||||||
all."x86_64-linux".all = (with (forSystem "x86_64-linux" ({ system, pkgs, ... }: pkgs)); pkgs.releaseTools.aggregate {
|
all."x86_64-linux".all = (with (forSystem "x86_64-linux" ({ system, pkgs, ... }: pkgs)); pkgs.releaseTools.aggregate {
|
||||||
name = "all";
|
name = "all";
|
||||||
constituents = [
|
constituents = [
|
||||||
all."x86_64-linux".install-default
|
all."x86_64-linux".install-default
|
||||||
all."x86_64-linux".install-no-start-daemon
|
all."x86_64-linux".install-no-start-daemon
|
||||||
all."x86_64-linux".install-daemonless
|
all."x86_64-linux".install-daemonless
|
||||||
|
all."x86_64-linux".install-preexisting-self-working
|
||||||
|
# all."x86_64-linux".install-preexisting-self-broken-no-nix-path
|
||||||
|
all."x86_64-linux".install-preexisting-self-broken-missing-users
|
||||||
|
all."x86_64-linux".install-preexisting-self-broken-daemon-disabled
|
||||||
|
all."x86_64-linux".install-preexisting-self-broken-no-etc-nix
|
||||||
|
all."x86_64-linux".install-preexisting-self-broken-unmodified-bashrc
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue