From fae3b4fe8abc2b307a583e396a24d7899bb21451 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 14 Sep 2022 15:40:43 +0200 Subject: [PATCH 01/15] Add an installer test This runs the installer in a QEMU VM. Unlike the old installer test that ran inside a declaratively built RedHat/Debian image, this uses an image from Vagrant. --- flake.nix | 5 + tests/installer/default.nix | 136 +++++++++++++++++++++++++++ tests/installer/vagrant_insecure_key | 27 ++++++ 3 files changed, 168 insertions(+) create mode 100644 tests/installer/default.nix create mode 100644 tests/installer/vagrant_insecure_key diff --git a/flake.nix b/flake.nix index cdb81179a..ec64719d1 100644 --- a/flake.nix +++ b/flake.nix @@ -546,6 +546,11 @@ # againstLatestStable = testNixVersions pkgs pkgs.nix pkgs.nixStable; } "touch $out"); + installerTests = import ./tests/installer { + binaryTarballs = self.hydraJobs.binaryTarball; + inherit nixpkgsFor; + }; + }; checks = forAllSystems (system: { diff --git a/tests/installer/default.nix b/tests/installer/default.nix new file mode 100644 index 000000000..39911aeb2 --- /dev/null +++ b/tests/installer/default.nix @@ -0,0 +1,136 @@ +{ binaryTarballs +, nixpkgsFor +}: + +let + + installScripts = { + install-default = { + script = '' + set -eux + + tar -xf ./nix.tar.xz + mv ./nix-* nix + ./nix/install --no-channel-add + ''; + }; + + install-force-no-daemon = { + script = '' + set -eux + + tar -xf ./nix.tar.xz + mv ./nix-* nix + ./nix/install --no-daemon + ''; + }; + + install-force-daemon = { + script = '' + set -eux + + tar -xf ./nix.tar.xz + mv ./nix-* nix + ./nix/install --daemon + ''; + }; + }; + + images = { + + "ubuntu-14-04" = { + image = import { + url = https://app.vagrantup.com/ubuntu/boxes/trusty64/versions/20190514.0.0/providers/virtualbox.box; + hash = "sha256-iUUXyRY8iW7DGirb0zwGgf1fRbLA7wimTJKgP7l/OQ8="; + }; + rootDisk = "box-disk1.vmdk"; + system = "x86_64-linux"; + }; + + "ubuntu-16-04" = { + image = import { + url = https://app.vagrantup.com/ubuntu/boxes/xenial64/versions/20211001.0.0/providers/virtualbox.box; + hash = "sha256-JCc0wd9vaSzCU8coByVtb/oDTAXYBPnORwEShS4oj4U="; + }; + rootDisk = "ubuntu-xenial-16.04-cloudimg.vmdk"; + system = "x86_64-linux"; + }; + + "ubuntu-22-10" = { + image = import { + url = https://app.vagrantup.com/ubuntu/boxes/kinetic64/versions/20220910.0.0/providers/virtualbox.box; + hash = "sha256-/IXr+Apyx2dqX6Gj4SoNtQ/5v1eKKopwzFgozAq6GFY="; + }; + rootDisk = "ubuntu-kinetic-22.10-cloudimg.vmdk"; + system = "x86_64-linux"; + }; + + }; + + makeTest = imageName: testName: + let image = images.${imageName}; in + with nixpkgsFor.${image.system}; + runCommand + "installer-test-${imageName}-${testName}" + { buildInputs = [ qemu_kvm openssh ]; + image = image.image; + installScript = installScripts.${testName}.script; + binaryTarball = binaryTarballs.${system}; + } + '' + echo "Unpacking Vagrant box..." + tar xvf $image + + qemu-img create -b ./${image.rootDisk} -F vmdk -f qcow2 ./disk.qcow2 + + echo "Starting qemu..." + qemu-kvm -m 4096 -nographic \ + -drive id=disk1,file=./disk.qcow2,if=virtio \ + -netdev user,id=net0,restrict=yes,hostfwd=tcp::20022-:22 -device virtio-net-pci,netdev=net0 & + qemu_pid=$! + trap "kill $qemu_pid" EXIT + + if ! [ -e ./vagrant_insecure_key ]; then + cp ${./vagrant_insecure_key} vagrant_insecure_key + fi + + chmod 0400 ./vagrant_insecure_key + + ssh_opts="-o StrictHostKeyChecking=no -o PubkeyAcceptedKeyTypes=+ssh-rsa -i ./vagrant_insecure_key" + ssh="ssh -p 20022 -q $ssh_opts vagrant@localhost" + + echo "Waiting for SSH..." + for ((i = 0; i < 120; i++)); do + echo "[ssh] Trying to connect..." + if $ssh -- true; then + echo "[ssh] Connected!" + break + fi + if ! kill -0 $qemu_pid; then + echo "qemu died unexpectedly" + exit 1 + fi + sleep 1 + done + + echo "Copying installer..." + scp -P 20022 $ssh_opts $binaryTarball/nix-*.tar.xz vagrant@localhost:nix.tar.xz + + echo "Running installer..." + $ssh "$installScript" + + echo "Testing Nix installation..." + # FIXME: should update ~/.bashrc. + $ssh "source ~/.profile; nix-env --version" + + echo "Done!" + touch $out + ''; + +in + +{ + ubuntu-14-04.install-default = makeTest "ubuntu-14-04" "install-default"; + #ubuntu-16-04.install-default = makeTest "ubuntu-16-04" "install-default"; + #ubuntu-22-10.install-default = makeTest "ubuntu-22-10" "install-default"; +} diff --git a/tests/installer/vagrant_insecure_key b/tests/installer/vagrant_insecure_key new file mode 100644 index 000000000..7d6a08390 --- /dev/null +++ b/tests/installer/vagrant_insecure_key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEogIBAAKCAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzI +w+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoP +kcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2 +hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NO +Td0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcW +yLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQIBIwKCAQEA4iqWPJXtzZA68mKd +ELs4jJsdyky+ewdZeNds5tjcnHU5zUYE25K+ffJED9qUWICcLZDc81TGWjHyAqD1 +Bw7XpgUwFgeUJwUlzQurAv+/ySnxiwuaGJfhFM1CaQHzfXphgVml+fZUvnJUTvzf +TK2Lg6EdbUE9TarUlBf/xPfuEhMSlIE5keb/Zz3/LUlRg8yDqz5w+QWVJ4utnKnK +iqwZN0mwpwU7YSyJhlT4YV1F3n4YjLswM5wJs2oqm0jssQu/BT0tyEXNDYBLEF4A +sClaWuSJ2kjq7KhrrYXzagqhnSei9ODYFShJu8UWVec3Ihb5ZXlzO6vdNQ1J9Xsf +4m+2ywKBgQD6qFxx/Rv9CNN96l/4rb14HKirC2o/orApiHmHDsURs5rUKDx0f9iP +cXN7S1uePXuJRK/5hsubaOCx3Owd2u9gD6Oq0CsMkE4CUSiJcYrMANtx54cGH7Rk +EjFZxK8xAv1ldELEyxrFqkbE4BKd8QOt414qjvTGyAK+OLD3M2QdCQKBgQDtx8pN +CAxR7yhHbIWT1AH66+XWN8bXq7l3RO/ukeaci98JfkbkxURZhtxV/HHuvUhnPLdX +3TwygPBYZFNo4pzVEhzWoTtnEtrFueKxyc3+LjZpuo+mBlQ6ORtfgkr9gBVphXZG +YEzkCD3lVdl8L4cw9BVpKrJCs1c5taGjDgdInQKBgHm/fVvv96bJxc9x1tffXAcj +3OVdUN0UgXNCSaf/3A/phbeBQe9xS+3mpc4r6qvx+iy69mNBeNZ0xOitIjpjBo2+ +dBEjSBwLk5q5tJqHmy/jKMJL4n9ROlx93XS+njxgibTvU6Fp9w+NOFD/HvxB3Tcz +6+jJF85D5BNAG3DBMKBjAoGBAOAxZvgsKN+JuENXsST7F89Tck2iTcQIT8g5rwWC +P9Vt74yboe2kDT531w8+egz7nAmRBKNM751U/95P9t88EDacDI/Z2OwnuFQHCPDF +llYOUI+SpLJ6/vURRbHSnnn8a/XG+nzedGH5JGqEJNQsz+xT2axM0/W/CRknmGaJ +kda/AoGANWrLCz708y7VYgAtW2Uf1DPOIYMdvo6fxIB5i9ZfISgcJ/bbCUkFrhoH ++vq/5CIWxCPp0f85R4qxxQ5ihxJ0YDQT9Jpx4TMss4PSavPaBH3RXow5Ohe+bYoQ +NE5OgEXk2wVfZczCZpigBKbKZHNYcelXtTt/nP3rsCuGcM4h53s= +-----END RSA PRIVATE KEY----- From 0a8e666dd6d18ede4b5cd648e19d5950ee19f095 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 14 Sep 2022 18:40:16 +0200 Subject: [PATCH 02/15] Add Fedora 36 --- tests/installer/default.nix | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/installer/default.nix b/tests/installer/default.nix index 39911aeb2..ab3ef62f0 100644 --- a/tests/installer/default.nix +++ b/tests/installer/default.nix @@ -65,6 +65,16 @@ let system = "x86_64-linux"; }; + + "fedora-36" = { + image = import { + url = https://app.vagrantup.com/generic/boxes/fedora36/versions/4.1.12/providers/libvirt.box; + hash = "sha256-rxPgnDnFkTDwvdqn2CV3ZUo3re9AdPtSZ9SvOHNvaks="; + }; + rootDisk = "box.img"; + system = "x86_64-linux"; + }; + }; makeTest = imageName: testName: @@ -78,10 +88,12 @@ let binaryTarball = binaryTarballs.${system}; } '' - echo "Unpacking Vagrant box..." + echo "Unpacking Vagrant box $image..." tar xvf $image - qemu-img create -b ./${image.rootDisk} -F vmdk -f qcow2 ./disk.qcow2 + image_type=$(qemu-img info ${image.rootDisk} | sed 's/file format: \(.*\)/\1/; t; d') + + qemu-img create -b ./${image.rootDisk} -F "$image_type" -f qcow2 ./disk.qcow2 echo "Starting qemu..." qemu-kvm -m 4096 -nographic \ @@ -121,7 +133,7 @@ let echo "Testing Nix installation..." # FIXME: should update ~/.bashrc. - $ssh "source ~/.profile; nix-env --version" + $ssh "source ~/.bash_profile || source ~/.bash_login || source ~/.profile || true; nix-env --version" echo "Done!" touch $out @@ -133,4 +145,5 @@ in ubuntu-14-04.install-default = makeTest "ubuntu-14-04" "install-default"; #ubuntu-16-04.install-default = makeTest "ubuntu-16-04" "install-default"; #ubuntu-22-10.install-default = makeTest "ubuntu-22-10" "install-default"; + fedora-36.install-default = makeTest "fedora-36" "install-default"; } From 906c947ee8f2478d27e5eda649f44716e952d8a6 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 14 Sep 2022 18:53:30 +0200 Subject: [PATCH 03/15] Enable daemon installation test on Fedora --- tests/installer/default.nix | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/tests/installer/default.nix b/tests/installer/default.nix index ab3ef62f0..8b6bde73f 100644 --- a/tests/installer/default.nix +++ b/tests/installer/default.nix @@ -7,8 +7,6 @@ let installScripts = { install-default = { script = '' - set -eux - tar -xf ./nix.tar.xz mv ./nix-* nix ./nix/install --no-channel-add @@ -17,8 +15,6 @@ let install-force-no-daemon = { script = '' - set -eux - tar -xf ./nix.tar.xz mv ./nix-* nix ./nix/install --no-daemon @@ -27,15 +23,15 @@ let install-force-daemon = { script = '' - set -eux - tar -xf ./nix.tar.xz mv ./nix-* nix - ./nix/install --daemon + ./nix/install --daemon --no-channel-add ''; }; }; + disableSELinux = "sudo setenforce 0"; + images = { "ubuntu-14-04" = { @@ -65,7 +61,6 @@ let system = "x86_64-linux"; }; - "fedora-36" = { image = import { url = https://app.vagrantup.com/generic/boxes/fedora36/versions/4.1.12/providers/libvirt.box; @@ -73,6 +68,7 @@ let }; rootDisk = "box.img"; system = "x86_64-linux"; + postBoot = disableSELinux; }; }; @@ -84,6 +80,7 @@ let "installer-test-${imageName}-${testName}" { buildInputs = [ qemu_kvm openssh ]; image = image.image; + postBoot = image.postBoot or ""; installScript = installScripts.${testName}.script; binaryTarball = binaryTarballs.${system}; } @@ -125,15 +122,25 @@ let sleep 1 done + if [[ -n $postBoot ]]; then + echo "Running post-boot commands..." + $ssh "set -ex; $postBoot" + fi + echo "Copying installer..." scp -P 20022 $ssh_opts $binaryTarball/nix-*.tar.xz vagrant@localhost:nix.tar.xz echo "Running installer..." - $ssh "$installScript" + $ssh "set -eux; $installScript" echo "Testing Nix installation..." # FIXME: should update ~/.bashrc. - $ssh "source ~/.bash_profile || source ~/.bash_login || source ~/.profile || true; nix-env --version" + $ssh " + set -ex + source ~/.bash_profile || source ~/.bash_login || source ~/.profile || true + nix-env --version + nix --extra-experimental-features nix-command store ping + " echo "Done!" touch $out @@ -146,4 +153,5 @@ in #ubuntu-16-04.install-default = makeTest "ubuntu-16-04" "install-default"; #ubuntu-22-10.install-default = makeTest "ubuntu-22-10" "install-default"; fedora-36.install-default = makeTest "fedora-36" "install-default"; + fedora-36.install-force-daemon = makeTest "fedora-36" "install-force-daemon"; } From cc6e31231547fc64c89c6682316f2bab03db6879 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 14 Sep 2022 19:44:41 +0200 Subject: [PATCH 04/15] Get Ubuntu 22.10 to work --- tests/installer/default.nix | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tests/installer/default.nix b/tests/installer/default.nix index 8b6bde73f..9b2a34bdb 100644 --- a/tests/installer/default.nix +++ b/tests/installer/default.nix @@ -85,6 +85,8 @@ let binaryTarball = binaryTarballs.${system}; } '' + shopt -s nullglob + echo "Unpacking Vagrant box $image..." tar xvf $image @@ -92,10 +94,19 @@ let qemu-img create -b ./${image.rootDisk} -F "$image_type" -f qcow2 ./disk.qcow2 + extra_qemu_opts= + + # Add the config disk, required by the Ubuntu images. + config_drive=$(echo *configdrive.vmdk || true) + if [[ -n $config_drive ]]; then + extra_qemu_opts+=" -drive id=disk2,file=$config_drive,if=virtio" + fi + echo "Starting qemu..." qemu-kvm -m 4096 -nographic \ -drive id=disk1,file=./disk.qcow2,if=virtio \ - -netdev user,id=net0,restrict=yes,hostfwd=tcp::20022-:22 -device virtio-net-pci,netdev=net0 & + -netdev user,id=net0,restrict=yes,hostfwd=tcp::20022-:22 -device virtio-net-pci,netdev=net0 \ + $extra_qemu_opts & qemu_pid=$! trap "kill $qemu_pid" EXIT @@ -137,7 +148,13 @@ let # FIXME: should update ~/.bashrc. $ssh " set -ex - source ~/.bash_profile || source ~/.bash_login || source ~/.profile || true + + # FIXME: get rid of this; ideally ssh should just work. + source ~/.bash_profile || true + source ~/.bash_login || true + source ~/.profile || true + source /etc/bashrc || true + nix-env --version nix --extra-experimental-features nix-command store ping " @@ -151,7 +168,8 @@ in { ubuntu-14-04.install-default = makeTest "ubuntu-14-04" "install-default"; #ubuntu-16-04.install-default = makeTest "ubuntu-16-04" "install-default"; - #ubuntu-22-10.install-default = makeTest "ubuntu-22-10" "install-default"; + ubuntu-22-10.install-default = makeTest "ubuntu-22-10" "install-default"; + ubuntu-22-10.install-force-daemon = makeTest "ubuntu-22-10" "install-force-daemon"; fedora-36.install-default = makeTest "fedora-36" "install-default"; fedora-36.install-force-daemon = makeTest "fedora-36" "install-force-daemon"; } From fe958a682d293dec5f27d0c161833b453370d755 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 15 Sep 2022 11:42:10 +0200 Subject: [PATCH 05/15] Test building --- tests/installer/default.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/installer/default.nix b/tests/installer/default.nix index 9b2a34bdb..d0707018f 100644 --- a/tests/installer/default.nix +++ b/tests/installer/default.nix @@ -146,7 +146,7 @@ let echo "Testing Nix installation..." # FIXME: should update ~/.bashrc. - $ssh " + $ssh < \$out"]; }') + [[ \$(cat \$out) = foobar ]] + EOF echo "Done!" touch $out From 29aaec1e593f1837a73779f243ed0ec4220f7ea8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 15 Sep 2022 13:15:26 +0200 Subject: [PATCH 06/15] Make cross product of images and tests --- tests/installer/default.nix | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/installer/default.nix b/tests/installer/default.nix index d0707018f..72ad764cc 100644 --- a/tests/installer/default.nix +++ b/tests/installer/default.nix @@ -168,11 +168,9 @@ let in -{ - ubuntu-14-04.install-default = makeTest "ubuntu-14-04" "install-default"; - #ubuntu-16-04.install-default = makeTest "ubuntu-16-04" "install-default"; - ubuntu-22-10.install-default = makeTest "ubuntu-22-10" "install-default"; - ubuntu-22-10.install-force-daemon = makeTest "ubuntu-22-10" "install-force-daemon"; - fedora-36.install-default = makeTest "fedora-36" "install-default"; - fedora-36.install-force-daemon = makeTest "fedora-36" "install-force-daemon"; -} +builtins.mapAttrs (imageName: image: + { ${image.system} = builtins.mapAttrs (testName: test: + makeTest imageName testName + ) installScripts; + } +) images From 5c8cdb9b60e0e8d24458a15577e4be3aaa16b600 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 15 Sep 2022 13:19:46 +0200 Subject: [PATCH 07/15] Add Ubuntu 22.04 LTS --- tests/installer/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/installer/default.nix b/tests/installer/default.nix index 72ad764cc..17b0fd4ea 100644 --- a/tests/installer/default.nix +++ b/tests/installer/default.nix @@ -52,6 +52,15 @@ let system = "x86_64-linux"; }; + "ubuntu-22-04" = { + image = import { + url = https://app.vagrantup.com/generic/boxes/ubuntu2204/versions/4.1.12/providers/libvirt.box; + hash = "sha256-HNll0Qikw/xGIcogni5lz01vUv+R3o8xowP2EtqjuUQ="; + }; + rootDisk = "box.img"; + system = "x86_64-linux"; + }; + "ubuntu-22-10" = { image = import { url = https://app.vagrantup.com/ubuntu/boxes/kinetic64/versions/20220910.0.0/providers/virtualbox.box; From ef714aa8a566bbdb30919ffd45b8a1fd8e2bc484 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 15 Sep 2022 13:25:26 +0200 Subject: [PATCH 08/15] Remove pre-release Ubuntu 22.10 --- tests/installer/default.nix | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/installer/default.nix b/tests/installer/default.nix index 17b0fd4ea..a2cbbcbb8 100644 --- a/tests/installer/default.nix +++ b/tests/installer/default.nix @@ -61,15 +61,6 @@ let system = "x86_64-linux"; }; - "ubuntu-22-10" = { - image = import { - url = https://app.vagrantup.com/ubuntu/boxes/kinetic64/versions/20220910.0.0/providers/virtualbox.box; - hash = "sha256-/IXr+Apyx2dqX6Gj4SoNtQ/5v1eKKopwzFgozAq6GFY="; - }; - rootDisk = "ubuntu-kinetic-22.10-cloudimg.vmdk"; - system = "x86_64-linux"; - }; - "fedora-36" = { image = import { url = https://app.vagrantup.com/generic/boxes/fedora36/versions/4.1.12/providers/libvirt.box; From 503f31e2a0de3192ccc572cc17a6dd02863ebec8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 15 Sep 2022 13:28:03 +0200 Subject: [PATCH 09/15] Use libvirt image --- tests/installer/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/installer/default.nix b/tests/installer/default.nix index a2cbbcbb8..39e3c8d26 100644 --- a/tests/installer/default.nix +++ b/tests/installer/default.nix @@ -45,10 +45,10 @@ let "ubuntu-16-04" = { image = import { - url = https://app.vagrantup.com/ubuntu/boxes/xenial64/versions/20211001.0.0/providers/virtualbox.box; - hash = "sha256-JCc0wd9vaSzCU8coByVtb/oDTAXYBPnORwEShS4oj4U="; + url = https://app.vagrantup.com/generic/boxes/ubuntu1604/versions/4.1.12/providers/libvirt.box; + hash = "sha256-lO4oYQR2tCh5auxAYe6bPOgEqOgv3Y3GC1QM1tEEEU8="; }; - rootDisk = "ubuntu-xenial-16.04-cloudimg.vmdk"; + rootDisk = "box.img"; system = "x86_64-linux"; }; From a96ad2ab25ea054b9d1c473ce2f692bd1f83402b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 15 Sep 2022 14:51:10 +0200 Subject: [PATCH 10/15] Add RHEL 7/8 --- tests/installer/default.nix | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/tests/installer/default.nix b/tests/installer/default.nix index 39e3c8d26..d31e2a949 100644 --- a/tests/installer/default.nix +++ b/tests/installer/default.nix @@ -71,6 +71,38 @@ let postBoot = disableSELinux; }; + # Currently fails with 'error while loading shared libraries: + # libsodium.so.23: cannot stat shared object: Invalid argument'. + /* + "rhel-6" = { + image = import { + url = https://app.vagrantup.com/generic/boxes/rhel6/versions/4.1.12/providers/libvirt.box; + hash = "sha256-QwzbvRoRRGqUCQptM7X/InRWFSP2sqwRt2HaaO6zBGM="; + }; + rootDisk = "box.img"; + system = "x86_64-linux"; + }; + */ + + "rhel-7" = { + image = import { + url = https://app.vagrantup.com/generic/boxes/rhel7/versions/4.1.12/providers/libvirt.box; + hash = "sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="; + }; + rootDisk = "box.img"; + system = "x86_64-linux"; + }; + + "rhel-8" = { + image = import { + url = https://app.vagrantup.com/generic/boxes/rhel8/versions/4.1.12/providers/libvirt.box; + hash = "sha256-zFOPjSputy1dPgrQRixBXmlyN88cAKjJ21VvjSWUCUY="; + }; + rootDisk = "box.img"; + system = "x86_64-linux"; + postBoot = disableSELinux; + }; + }; makeTest = imageName: testName: @@ -116,7 +148,7 @@ let chmod 0400 ./vagrant_insecure_key - ssh_opts="-o StrictHostKeyChecking=no -o PubkeyAcceptedKeyTypes=+ssh-rsa -i ./vagrant_insecure_key" + ssh_opts="-o StrictHostKeyChecking=no -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa -i ./vagrant_insecure_key" ssh="ssh -p 20022 -q $ssh_opts vagrant@localhost" echo "Waiting for SSH..." From ba04b5b1d74c285e12fc3d24524cb8f30f108767 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 15 Sep 2022 14:51:44 +0200 Subject: [PATCH 11/15] Disable Ubuntu 14.04 --- tests/installer/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/installer/default.nix b/tests/installer/default.nix index d31e2a949..a3a7f85f9 100644 --- a/tests/installer/default.nix +++ b/tests/installer/default.nix @@ -34,6 +34,7 @@ let images = { + /* "ubuntu-14-04" = { image = import { url = https://app.vagrantup.com/ubuntu/boxes/trusty64/versions/20190514.0.0/providers/virtualbox.box; @@ -42,6 +43,7 @@ let rootDisk = "box-disk1.vmdk"; system = "x86_64-linux"; }; + */ "ubuntu-16-04" = { image = import { From 3dd313a7c20772ef34af4a43fb3673df1e7d00cf Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 15 Sep 2022 15:50:52 +0200 Subject: [PATCH 12/15] Add RHEL 9 --- tests/installer/default.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/installer/default.nix b/tests/installer/default.nix index a3a7f85f9..eab103562 100644 --- a/tests/installer/default.nix +++ b/tests/installer/default.nix @@ -105,6 +105,17 @@ let postBoot = disableSELinux; }; + "rhel-9" = { + image = import { + url = https://app.vagrantup.com/generic/boxes/rhel9/versions/4.1.12/providers/libvirt.box; + hash = "sha256-vL/FbB3kK1rcSaR627nWmScYGKGk4seSmAdq6N5diMg="; + }; + rootDisk = "box.img"; + system = "x86_64-linux"; + postBoot = disableSELinux; + extraQemuOpts = "-cpu Westmere-v2"; + }; + }; makeTest = imageName: testName: @@ -128,7 +139,7 @@ let qemu-img create -b ./${image.rootDisk} -F "$image_type" -f qcow2 ./disk.qcow2 - extra_qemu_opts= + extra_qemu_opts="${image.extraQemuOpts}" # Add the config disk, required by the Ubuntu images. config_drive=$(echo *configdrive.vmdk || true) From 0d4bf9c4d836f8e8570ad1d39245a5835ef4aaf1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 15 Sep 2022 15:56:46 +0200 Subject: [PATCH 13/15] Fix evaluation --- tests/installer/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/installer/default.nix b/tests/installer/default.nix index eab103562..c118937a6 100644 --- a/tests/installer/default.nix +++ b/tests/installer/default.nix @@ -139,7 +139,7 @@ let qemu-img create -b ./${image.rootDisk} -F "$image_type" -f qcow2 ./disk.qcow2 - extra_qemu_opts="${image.extraQemuOpts}" + extra_qemu_opts="${image.extraQemuOpts or ""}" # Add the config disk, required by the Ubuntu images. config_drive=$(echo *configdrive.vmdk || true) From eceaf1997ca5e88549e7ea0ab72104777dee4e87 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 26 Sep 2022 16:54:31 +0200 Subject: [PATCH 14/15] Remove FIXME --- tests/installer/default.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/installer/default.nix b/tests/installer/default.nix index c118937a6..8686dbb96 100644 --- a/tests/installer/default.nix +++ b/tests/installer/default.nix @@ -190,7 +190,6 @@ let $ssh "set -eux; $installScript" echo "Testing Nix installation..." - # FIXME: should update ~/.bashrc. $ssh < Date: Mon, 26 Sep 2022 16:57:06 +0200 Subject: [PATCH 15/15] Quote URLs --- tests/installer/default.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/installer/default.nix b/tests/installer/default.nix index 8686dbb96..32aa7889a 100644 --- a/tests/installer/default.nix +++ b/tests/installer/default.nix @@ -37,7 +37,7 @@ let /* "ubuntu-14-04" = { image = import { - url = https://app.vagrantup.com/ubuntu/boxes/trusty64/versions/20190514.0.0/providers/virtualbox.box; + url = "https://app.vagrantup.com/ubuntu/boxes/trusty64/versions/20190514.0.0/providers/virtualbox.box"; hash = "sha256-iUUXyRY8iW7DGirb0zwGgf1fRbLA7wimTJKgP7l/OQ8="; }; rootDisk = "box-disk1.vmdk"; @@ -47,7 +47,7 @@ let "ubuntu-16-04" = { image = import { - url = https://app.vagrantup.com/generic/boxes/ubuntu1604/versions/4.1.12/providers/libvirt.box; + url = "https://app.vagrantup.com/generic/boxes/ubuntu1604/versions/4.1.12/providers/libvirt.box"; hash = "sha256-lO4oYQR2tCh5auxAYe6bPOgEqOgv3Y3GC1QM1tEEEU8="; }; rootDisk = "box.img"; @@ -56,7 +56,7 @@ let "ubuntu-22-04" = { image = import { - url = https://app.vagrantup.com/generic/boxes/ubuntu2204/versions/4.1.12/providers/libvirt.box; + url = "https://app.vagrantup.com/generic/boxes/ubuntu2204/versions/4.1.12/providers/libvirt.box"; hash = "sha256-HNll0Qikw/xGIcogni5lz01vUv+R3o8xowP2EtqjuUQ="; }; rootDisk = "box.img"; @@ -65,7 +65,7 @@ let "fedora-36" = { image = import { - url = https://app.vagrantup.com/generic/boxes/fedora36/versions/4.1.12/providers/libvirt.box; + url = "https://app.vagrantup.com/generic/boxes/fedora36/versions/4.1.12/providers/libvirt.box"; hash = "sha256-rxPgnDnFkTDwvdqn2CV3ZUo3re9AdPtSZ9SvOHNvaks="; }; rootDisk = "box.img"; @@ -78,7 +78,7 @@ let /* "rhel-6" = { image = import { - url = https://app.vagrantup.com/generic/boxes/rhel6/versions/4.1.12/providers/libvirt.box; + url = "https://app.vagrantup.com/generic/boxes/rhel6/versions/4.1.12/providers/libvirt.box"; hash = "sha256-QwzbvRoRRGqUCQptM7X/InRWFSP2sqwRt2HaaO6zBGM="; }; rootDisk = "box.img"; @@ -88,7 +88,7 @@ let "rhel-7" = { image = import { - url = https://app.vagrantup.com/generic/boxes/rhel7/versions/4.1.12/providers/libvirt.box; + url = "https://app.vagrantup.com/generic/boxes/rhel7/versions/4.1.12/providers/libvirt.box"; hash = "sha256-b4afnqKCO9oWXgYHb9DeQ2berSwOjS27rSd9TxXDc/U="; }; rootDisk = "box.img"; @@ -97,7 +97,7 @@ let "rhel-8" = { image = import { - url = https://app.vagrantup.com/generic/boxes/rhel8/versions/4.1.12/providers/libvirt.box; + url = "https://app.vagrantup.com/generic/boxes/rhel8/versions/4.1.12/providers/libvirt.box"; hash = "sha256-zFOPjSputy1dPgrQRixBXmlyN88cAKjJ21VvjSWUCUY="; }; rootDisk = "box.img"; @@ -107,7 +107,7 @@ let "rhel-9" = { image = import { - url = https://app.vagrantup.com/generic/boxes/rhel9/versions/4.1.12/providers/libvirt.box; + url = "https://app.vagrantup.com/generic/boxes/rhel9/versions/4.1.12/providers/libvirt.box"; hash = "sha256-vL/FbB3kK1rcSaR627nWmScYGKGk4seSmAdq6N5diMg="; }; rootDisk = "box.img";