lol

nixos/tests/systemd-nspawn: add test for machinectl pull-tar

This will package up the closure of pkgs.hello in a tarball, and will
later on verify machinectl pull-tar properly unpacked it, serving as a
regression test for #108158.

Closes #108158

authored by

Florian Klink and committed by
sternenseemann
dbf2b915 17c252aa

+12 -1
+12 -1
nixos/tests/systemd-nspawn.nix
··· 25 25 nspawnImages = (pkgs.runCommand "localhost" { buildInputs = [ pkgs.coreutils pkgs.gnupg ]; } '' 26 26 mkdir -p $out 27 27 cd $out 28 + 29 + # produce a testimage.raw 28 30 dd if=/dev/urandom of=$out/testimage.raw bs=$((1024*1024+7)) count=5 29 - sha256sum testimage.raw > SHA256SUMS 31 + 32 + # produce a testimage2.tar.xz, containing the hello store path 33 + tar cvJpf testimage2.tar.xz ${pkgs.hello} 34 + 35 + # produce signature(s) 36 + sha256sum testimage* > SHA256SUMS 30 37 export GNUPGHOME="$(mktemp -d)" 31 38 cp -R ${gpgKeyring}/* $GNUPGHOME 32 39 gpg --batch --sign --detach-sign --output SHA256SUMS.gpg SHA256SUMS ··· 55 62 client.succeed("machinectl pull-raw --verify=signature http://server/testimage.raw") 56 63 client.succeed( 57 64 "cmp /var/lib/machines/testimage.raw ${nspawnImages}/testimage.raw" 65 + ) 66 + client.succeed("machinectl pull-tar --verify=signature http://server/testimage2.tar.xz") 67 + client.succeed( 68 + "cmp /var/lib/machines/testimage2/${pkgs.hello}/bin/hello ${pkgs.hello}/bin/hello" 58 69 ) 59 70 ''; 60 71 })