about summary refs log tree commit diff
path: root/nixos/tests/k3s
diff options
context:
space:
mode:
authorRobert Rose <robert.rose@mailbox.org>2024-05-04 21:35:17 +0200
committerRobert Rose <robert.rose@mailbox.org>2024-05-07 11:53:15 +0200
commit2b0b15ec94d24a1991ead8312802b8f8884235c6 (patch)
tree34ee8d909428e2544a8c68ab5abe6cdbe89a651a /nixos/tests/k3s
parent6c2d986176e8f6545263fa1467012ebf51880c0f (diff)
k3s: package k3s-killall script
Provide the k3s-killall.sh script for orderly shutdown of k3s.
Diffstat (limited to 'nixos/tests/k3s')
-rw-r--r--nixos/tests/k3s/single-node.nix12
1 files changed, 12 insertions, 0 deletions
diff --git a/nixos/tests/k3s/single-node.nix b/nixos/tests/k3s/single-node.nix
index fd64a050e61ef..b7ac5d9eeeac7 100644
--- a/nixos/tests/k3s/single-node.nix
+++ b/nixos/tests/k3s/single-node.nix
@@ -78,6 +78,18 @@ import ../make-test-python.nix ({ pkgs, lib, k3s, ... }:
       # regression test for #176445
       machine.fail("journalctl -o cat -u k3s.service | grep 'ipset utility not found'")
 
+      with subtest("Run k3s-killall"):
+          # Call the killall script with a clean path to assert that
+          # all required commands are wrapped
+          output = machine.succeed("PATH= ${k3s}/bin/k3s-killall.sh 2>&1 | tee /dev/stderr")
+          assert "command not found" not in output, "killall script contains unknown command"
+
+          # Check that killall cleaned up properly
+          machine.fail("systemctl is-active k3s.service")
+          machine.fail("systemctl list-units | grep containerd")
+          machine.fail("ip link show | awk -F': ' '{print $2}' | grep -e flannel -e cni0")
+          machine.fail("ip netns show | grep cni-")
+
       machine.shutdown()
     '';
   })