summary refs log tree commit diff
diff options
context:
space:
mode:
authorEuan Kemp <euank@euank.com>2021-10-25 17:43:27 -0700
committerEuan Kemp <euank@euank.com>2021-10-25 17:43:27 -0700
commit3c61779d5c15de7e9a34e3f0eb8e59f4dbadc1cc (patch)
tree3ce9160c9fd28ee0132c44421c317365ba9f4f36
parent83ed4b46fde24845c3157dcf0923210d6423998c (diff)
downloadnixpkgs-3c61779d5c15de7e9a34e3f0eb8e59f4dbadc1cc.tar
nixpkgs-3c61779d5c15de7e9a34e3f0eb8e59f4dbadc1cc.tar.gz
nixpkgs-3c61779d5c15de7e9a34e3f0eb8e59f4dbadc1cc.tar.bz2
nixpkgs-3c61779d5c15de7e9a34e3f0eb8e59f4dbadc1cc.tar.lz
nixpkgs-3c61779d5c15de7e9a34e3f0eb8e59f4dbadc1cc.tar.xz
nixpkgs-3c61779d5c15de7e9a34e3f0eb8e59f4dbadc1cc.tar.zst
nixpkgs-3c61779d5c15de7e9a34e3f0eb8e59f4dbadc1cc.zip
nixos/tests/k3s: address pr feedback
-rw-r--r--nixos/tests/k3s-single-node-docker.nix (renamed from nixos/tests/k3s-docker.nix)18
-rw-r--r--nixos/tests/k3s-single-node.nix (renamed from nixos/tests/k3s.nix)18
2 files changed, 22 insertions, 14 deletions
diff --git a/nixos/tests/k3s-docker.nix b/nixos/tests/k3s-single-node-docker.nix
index 62544e3ee13..7f3d15788b0 100644
--- a/nixos/tests/k3s-docker.nix
+++ b/nixos/tests/k3s-single-node-docker.nix
@@ -1,11 +1,14 @@
 import ./make-test-python.nix ({ pkgs, ... }:
 
   let
-    # A suitable k3s pause image, also used for the test pod
-    pauseImage = pkgs.dockerTools.buildImage {
+    imageEnv = pkgs.buildEnv {
+      name = "k3s-pause-image-env";
+      paths = with pkgs; [ tini (hiPrio coreutils) busybox ];
+    };
+    pauseImage = pkgs.dockerTools.streamLayeredImage {
       name = "test.local/pause";
       tag = "local";
-      contents = with pkgs; [ tini coreutils busybox ];
+      contents = imageEnv;
       config.Entrypoint = [ "/bin/tini" "--" "/bin/sleep" "inf" ];
     };
     # Don't use the default service account because there's a race where it may
@@ -39,8 +42,8 @@ import ./make-test-python.nix ({ pkgs, ... }:
       environment.systemPackages = with pkgs; [ k3s gzip ];
 
       # k3s uses enough resources the default vm fails.
-      virtualisation.memorySize = pkgs.lib.mkDefault 1536;
-      virtualisation.diskSize = pkgs.lib.mkDefault 4096;
+      virtualisation.memorySize = 1536;
+      virtualisation.diskSize = 4096;
 
       services.k3s = {
         enable = true;
@@ -65,10 +68,11 @@ import ./make-test-python.nix ({ pkgs, ... }:
       machine.wait_for_unit("k3s")
       machine.succeed("k3s kubectl cluster-info")
       machine.fail("sudo -u noprivs k3s kubectl cluster-info")
-      # machine.succeed("k3s check-config") # fails with the current nixos kernel config, uncomment once this passes
+      # FIXME: this fails with the current nixos kernel config; once it passes, we should uncomment it
+      # machine.succeed("k3s check-config")
 
       machine.succeed(
-          "zcat ${pauseImage} | docker load"
+          "${pauseImage} | docker load"
       )
 
       machine.succeed("k3s kubectl apply -f ${testPodYaml}")
diff --git a/nixos/tests/k3s.nix b/nixos/tests/k3s-single-node.nix
index dfebca50677..d98f20d468c 100644
--- a/nixos/tests/k3s.nix
+++ b/nixos/tests/k3s-single-node.nix
@@ -1,11 +1,14 @@
 import ./make-test-python.nix ({ pkgs, ... }:
 
   let
-    # A suitable k3s pause image, also used for the test pod
-    pauseImage = pkgs.dockerTools.buildImage {
+    imageEnv = pkgs.buildEnv {
+      name = "k3s-pause-image-env";
+      paths = with pkgs; [ tini (hiPrio coreutils) busybox ];
+    };
+    pauseImage = pkgs.dockerTools.streamLayeredImage {
       name = "test.local/pause";
       tag = "local";
-      contents = with pkgs; [ tini coreutils busybox ];
+      contents = imageEnv;
       config.Entrypoint = [ "/bin/tini" "--" "/bin/sleep" "inf" ];
     };
     # Don't use the default service account because there's a race where it may
@@ -39,8 +42,8 @@ import ./make-test-python.nix ({ pkgs, ... }:
       environment.systemPackages = with pkgs; [ k3s gzip ];
 
       # k3s uses enough resources the default vm fails.
-      virtualisation.memorySize = pkgs.lib.mkDefault 1536;
-      virtualisation.diskSize = pkgs.lib.mkDefault 4096;
+      virtualisation.memorySize = 1536;
+      virtualisation.diskSize = 4096;
 
       services.k3s.enable = true;
       services.k3s.role = "server";
@@ -63,10 +66,11 @@ import ./make-test-python.nix ({ pkgs, ... }:
       machine.wait_for_unit("k3s")
       machine.succeed("k3s kubectl cluster-info")
       machine.fail("sudo -u noprivs k3s kubectl cluster-info")
-      # machine.succeed("k3s check-config") # fails with the current nixos kernel config, uncomment once this passes
+      # FIXME: this fails with the current nixos kernel config; once it passes, we should uncomment it
+      # machine.succeed("k3s check-config")
 
       machine.succeed(
-          "zcat ${pauseImage} | k3s ctr image import -"
+          "${pauseImage} | k3s ctr image import -"
       )
 
       machine.succeed("k3s kubectl apply -f ${testPodYaml}")