From 9d1bd7016c5321eaa3135da107415408e35d60af Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Sun, 21 Jun 2026 23:09:46 -1000 Subject: [PATCH] kubernetes-helmPlugins.helm-unittest: add smoke passthru test Assisted-by: gpt-5.5 xhigh --- .../cluster/helm/plugins/helm-unittest.nix | 28 +++++++++++++++++-- .../tests/helm-unittest/smoke/Chart.yaml | 3 ++ .../smoke/templates/configmap.yaml | 6 ++++ .../smoke/tests/configmap_test.yaml | 11 ++++++++ 4 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 pkgs/applications/networking/cluster/helm/plugins/tests/helm-unittest/smoke/Chart.yaml create mode 100644 pkgs/applications/networking/cluster/helm/plugins/tests/helm-unittest/smoke/templates/configmap.yaml create mode 100644 pkgs/applications/networking/cluster/helm/plugins/tests/helm-unittest/smoke/tests/configmap_test.yaml diff --git a/pkgs/applications/networking/cluster/helm/plugins/helm-unittest.nix b/pkgs/applications/networking/cluster/helm/plugins/helm-unittest.nix index 983890fbc3c0..08d653227f02 100644 --- a/pkgs/applications/networking/cluster/helm/plugins/helm-unittest.nix +++ b/pkgs/applications/networking/cluster/helm/plugins/helm-unittest.nix @@ -1,14 +1,18 @@ { buildGoModule, fetchFromGitHub, + kubernetes-helm, lib, nix-update-script, + runCommand, + wrapHelm, + writableTmpDirAsHomeHook, }: let version = "1.1.1"; in -buildGoModule { +buildGoModule (finalAttrs: { pname = "helm-unittest"; inherit version; @@ -46,6 +50,26 @@ buildGoModule { ''; passthru = { + tests.smoke = + let + helm = wrapHelm kubernetes-helm { + plugins = [ finalAttrs.finalPackage ]; + }; + in + runCommand "helm-unittest-plugin-smoke" + { + nativeBuildInputs = [ + helm + writableTmpDirAsHomeHook + ]; + } + '' + cp -r ${./tests/helm-unittest/smoke} chart + chmod -R u+w chart + helm unittest chart + touch $out + ''; + updateScript = nix-update-script { }; }; @@ -58,4 +82,4 @@ buildGoModule { yurrriq ]; }; -} +}) diff --git a/pkgs/applications/networking/cluster/helm/plugins/tests/helm-unittest/smoke/Chart.yaml b/pkgs/applications/networking/cluster/helm/plugins/tests/helm-unittest/smoke/Chart.yaml new file mode 100644 index 000000000000..fe0d4f805044 --- /dev/null +++ b/pkgs/applications/networking/cluster/helm/plugins/tests/helm-unittest/smoke/Chart.yaml @@ -0,0 +1,3 @@ +apiVersion: v2 +name: smoke +version: 0.1.0 diff --git a/pkgs/applications/networking/cluster/helm/plugins/tests/helm-unittest/smoke/templates/configmap.yaml b/pkgs/applications/networking/cluster/helm/plugins/tests/helm-unittest/smoke/templates/configmap.yaml new file mode 100644 index 000000000000..25dff3db6797 --- /dev/null +++ b/pkgs/applications/networking/cluster/helm/plugins/tests/helm-unittest/smoke/templates/configmap.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: "{{ .Release.Name }}-smoke" +data: + value: "{{ .Values.value }}" diff --git a/pkgs/applications/networking/cluster/helm/plugins/tests/helm-unittest/smoke/tests/configmap_test.yaml b/pkgs/applications/networking/cluster/helm/plugins/tests/helm-unittest/smoke/tests/configmap_test.yaml new file mode 100644 index 000000000000..ce6b1ac74dec --- /dev/null +++ b/pkgs/applications/networking/cluster/helm/plugins/tests/helm-unittest/smoke/tests/configmap_test.yaml @@ -0,0 +1,11 @@ +suite: configmap +templates: + - templates/configmap.yaml +tests: + - it: renders the configured value + set: + value: ok + asserts: + - equal: + path: data.value + value: ok