summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2022-05-06 15:38:43 +0200
committersternenseemann <sternenseemann@systemli.org>2022-05-07 18:14:46 +0200
commitdbf2b9152fab6b6f2aa35c32d65ceec4cc61b394 (patch)
tree5f469dd2e1491f7d6d6596fc923b4779bd5df073 /nixos/tests
parent17c252aab1772d36acd6d3f57f6512f25b6f9e9c (diff)
downloadnixpkgs-dbf2b9152fab6b6f2aa35c32d65ceec4cc61b394.tar
nixpkgs-dbf2b9152fab6b6f2aa35c32d65ceec4cc61b394.tar.gz
nixpkgs-dbf2b9152fab6b6f2aa35c32d65ceec4cc61b394.tar.bz2
nixpkgs-dbf2b9152fab6b6f2aa35c32d65ceec4cc61b394.tar.lz
nixpkgs-dbf2b9152fab6b6f2aa35c32d65ceec4cc61b394.tar.xz
nixpkgs-dbf2b9152fab6b6f2aa35c32d65ceec4cc61b394.tar.zst
nixpkgs-dbf2b9152fab6b6f2aa35c32d65ceec4cc61b394.zip
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
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/systemd-nspawn.nix13
1 files changed, 12 insertions, 1 deletions
diff --git a/nixos/tests/systemd-nspawn.nix b/nixos/tests/systemd-nspawn.nix
index 5bf55060d2e..c2cb92d1130 100644
--- a/nixos/tests/systemd-nspawn.nix
+++ b/nixos/tests/systemd-nspawn.nix
@@ -25,8 +25,15 @@ let
   nspawnImages = (pkgs.runCommand "localhost" { buildInputs = [ pkgs.coreutils pkgs.gnupg ]; } ''
     mkdir -p $out
     cd $out
+
+    # produce a testimage.raw
     dd if=/dev/urandom of=$out/testimage.raw bs=$((1024*1024+7)) count=5
-    sha256sum testimage.raw > SHA256SUMS
+
+    # produce a testimage2.tar.xz, containing the hello store path
+    tar cvJpf testimage2.tar.xz ${pkgs.hello}
+
+    # produce signature(s)
+    sha256sum testimage* > SHA256SUMS
     export GNUPGHOME="$(mktemp -d)"
     cp -R ${gpgKeyring}/* $GNUPGHOME
     gpg --batch --sign --detach-sign --output SHA256SUMS.gpg SHA256SUMS
@@ -56,5 +63,9 @@ in {
     client.succeed(
         "cmp /var/lib/machines/testimage.raw ${nspawnImages}/testimage.raw"
     )
+    client.succeed("machinectl pull-tar --verify=signature http://server/testimage2.tar.xz")
+    client.succeed(
+        "cmp /var/lib/machines/testimage2/${pkgs.hello}/bin/hello ${pkgs.hello}/bin/hello"
+    )
   '';
 })