From b9acd426df4b1ae98da24f1a973968f83f5dcb19 Mon Sep 17 00:00:00 2001 From: Alexandru Scvortov Date: Tue, 27 Jul 2021 16:11:32 +0100 Subject: [PATCH] kubernetes: add passthru tests Also defensively quote a path and reformat a comment to trigger the right review. --- nixos/modules/services/cluster/kubernetes/pki.nix | 2 +- .../networking/cluster/kubernetes/default.nix | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/cluster/kubernetes/pki.nix b/nixos/modules/services/cluster/kubernetes/pki.nix index d9311d3e3a0..faf951d8157 100644 --- a/nixos/modules/services/cluster/kubernetes/pki.nix +++ b/nixos/modules/services/cluster/kubernetes/pki.nix @@ -189,7 +189,7 @@ in # manually paste it in place. Just symlink. # otherwise, create the target file, ready for users to insert the token - mkdir -p $(dirname ${certmgrAPITokenPath}) + mkdir -p "$(dirname "${certmgrAPITokenPath}")" if [ -f "${cfsslAPITokenPath}" ]; then ln -fs "${cfsslAPITokenPath}" "${certmgrAPITokenPath}" else diff --git a/pkgs/applications/networking/cluster/kubernetes/default.nix b/pkgs/applications/networking/cluster/kubernetes/default.nix index 2a66b391ae8..ac1e0aa9117 100644 --- a/pkgs/applications/networking/cluster/kubernetes/default.nix +++ b/pkgs/applications/networking/cluster/kubernetes/default.nix @@ -7,6 +7,7 @@ , makeWrapper , rsync , installShellFiles +, nixosTests , components ? [ "cmd/kubelet" @@ -66,8 +67,8 @@ stdenv.mkDerivation rec { install -D build/pause/linux/pause -t $pause/bin installManPage docs/man/man1/*.[1-9] - # Unfortunately, kube-addons-main.sh only looks for the lib file in either the current working dir - # or in /opt. We have to patch this for now. + # Unfortunately, kube-addons-main.sh only looks for the lib file in either the + # current working dir or in /opt. We have to patch this for now. substitute cluster/addons/addon-manager/kube-addons-main.sh $out/bin/kube-addons \ --subst-var out @@ -95,4 +96,11 @@ stdenv.mkDerivation rec { maintainers = with maintainers; [ johanot offline saschagrunert ]; platforms = platforms.unix; }; + + passthru.tests = with nixosTests.kubernetes; { + dns-single-node = dns.singlenode; + dns-multi-node = dns.multinode; + rbac-single-node = rbac.singlenode; + rbac-multi-node = rbac.multinode; + }; }