summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorLuflosi <luflosi@luflosi.de>2023-04-14 02:46:22 +0200
committerLuflosi <luflosi@luflosi.de>2023-04-15 15:24:49 +0200
commit409df93c01854b70606720a50da9bca283e8164e (patch)
tree9a954b8036333da0376077e2119fae3862737434 /nixos
parentbf97703f0e160307cc9318029b05a028e95f6ce3 (diff)
downloadnixpkgs-409df93c01854b70606720a50da9bca283e8164e.tar
nixpkgs-409df93c01854b70606720a50da9bca283e8164e.tar.gz
nixpkgs-409df93c01854b70606720a50da9bca283e8164e.tar.bz2
nixpkgs-409df93c01854b70606720a50da9bca283e8164e.tar.lz
nixpkgs-409df93c01854b70606720a50da9bca283e8164e.tar.xz
nixpkgs-409df93c01854b70606720a50da9bca283e8164e.tar.zst
nixpkgs-409df93c01854b70606720a50da9bca283e8164e.zip
nixos/tests/kubo: use subtests instead of comments
Specify the intent of parts of the tests by using `with subtest("...")` instead of a comment for more clarity.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/tests/kubo.nix58
1 files changed, 29 insertions, 29 deletions
diff --git a/nixos/tests/kubo.nix b/nixos/tests/kubo.nix
index 08468e31bf7..e0bd918150a 100644
--- a/nixos/tests/kubo.nix
+++ b/nixos/tests/kubo.nix
@@ -25,42 +25,42 @@
   testScript = ''
     start_all()
 
-    # IPv4 socket activation
-    machine.succeed("ipfs --api /ip4/127.0.0.1/tcp/2324 id")
-    ipfs_hash = machine.succeed(
-        "echo fnord | ipfs --api /ip4/127.0.0.1/tcp/2324 add --quieter"
-    )
-    machine.succeed(f"ipfs cat /ipfs/{ipfs_hash.strip()} | grep fnord")
+    with subtest("IPv4 socket activation"):
+        machine.succeed("ipfs --api /ip4/127.0.0.1/tcp/2324 id")
+        ipfs_hash = machine.succeed(
+            "echo fnord | ipfs --api /ip4/127.0.0.1/tcp/2324 add --quieter"
+        )
+        machine.succeed(f"ipfs cat /ipfs/{ipfs_hash.strip()} | grep fnord")
 
     machine.stop_job("ipfs")
 
-    # Unix domain socket activation
-    ipfs_hash = machine.succeed(
-        "echo fnord2 | ipfs --api /unix/run/ipfs.sock add --quieter"
-    )
-    machine.succeed(
-        f"ipfs --api /unix/run/ipfs.sock cat /ipfs/{ipfs_hash.strip()} | grep fnord2"
-    )
+    with subtest("Unix domain socket activation"):
+        ipfs_hash = machine.succeed(
+            "echo fnord2 | ipfs --api /unix/run/ipfs.sock add --quieter"
+        )
+        machine.succeed(
+            f"ipfs --api /unix/run/ipfs.sock cat /ipfs/{ipfs_hash.strip()} | grep fnord2"
+        )
 
-    # Test if setting dataDir works properly with the hardened systemd unit
-    machine.succeed("test -e /mnt/ipfs/config")
-    machine.succeed("test ! -e /var/lib/ipfs/")
+    with subtest("Setting dataDir works properly with the hardened systemd unit"):
+        machine.succeed("test -e /mnt/ipfs/config")
+        machine.succeed("test ! -e /var/lib/ipfs/")
 
-    # Test FUSE mountpoint
-    # The FUSE mount functionality is broken as of v0.13.0 and v0.17.0.
-    # See https://github.com/ipfs/kubo/issues/9044.
-    # Workaround: using CID Version 1 avoids that.
-    ipfs_hash = fuse.succeed(
-        "echo fnord3 | ipfs --api /ip4/127.0.0.1/tcp/2324 add --quieter --cid-version=1"
-    ).strip()
+    with subtest("FUSE mountpoint"):
+        # The FUSE mount functionality is broken as of v0.13.0 and v0.17.0.
+        # See https://github.com/ipfs/kubo/issues/9044.
+        # Workaround: using CID Version 1 avoids that.
+        ipfs_hash = fuse.succeed(
+            "echo fnord3 | ipfs --api /ip4/127.0.0.1/tcp/2324 add --quieter --cid-version=1"
+        ).strip()
 
-    fuse.succeed(f"cat /ipfs/{ipfs_hash} | grep fnord3")
+        fuse.succeed(f"cat /ipfs/{ipfs_hash} | grep fnord3")
 
-    # Force Kubo to crash and wait for it to restart
-    # Tests the unmounting of /ipns and /ipfs
-    fuse.systemctl("kill --signal=SIGKILL ipfs.service")
-    fuse.wait_for_unit("ipfs.service", timeout = 30)
+    with subtest("Unmounting of /ipns and /ipfs"):
+        # Force Kubo to crash and wait for it to restart
+        fuse.systemctl("kill --signal=SIGKILL ipfs.service")
+        fuse.wait_for_unit("ipfs.service", timeout = 30)
 
-    fuse.succeed(f"cat /ipfs/{ipfs_hash} | grep fnord3")
+        fuse.succeed(f"cat /ipfs/{ipfs_hash} | grep fnord3")
   '';
 }