From 89e5a46dd823fbcdd16b9a6ff0c9e583b35b8c55 Mon Sep 17 00:00:00 2001 From: Marco Vito Moscaritolo Date: Thu, 20 Jul 2023 17:06:32 +0200 Subject: [PATCH] feature(admission-controller,agent): update the unittest plugin --- .github/workflows/helm-unit-test.yaml | 2 +- Makefile | 2 +- charts/admission-controller/tests/label_test.yaml | 8 ++++---- charts/agent/tests/conditional_flag_test.yaml | 4 ++-- charts/agent/tests/label_test.yaml | 2 +- charts/sysdig-deploy/tests/notes_test.yaml | 3 +++ 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/helm-unit-test.yaml b/.github/workflows/helm-unit-test.yaml index bae31259e..3d1a729eb 100644 --- a/.github/workflows/helm-unit-test.yaml +++ b/.github/workflows/helm-unit-test.yaml @@ -17,7 +17,7 @@ jobs: version: v3.4.0 - name: Set up helm unit test plugin - run: helm plugin install https://github.com/helm-unittest/helm-unittest --version=0.3.0 + run: helm plugin install https://github.com/helm-unittest/helm-unittest --version=0.3.3 - name: Bundle chart dependencies run: make deps diff --git a/Makefile b/Makefile index b4e605fdf..005c04bd2 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ lint: docker run --rm -e CT_VALIDATE_MAINTAINERS=false -u $(shell id -u) -v $(PWD):/charts quay.io/helmpack/chart-testing:latest sh -c "cd /charts; ct lint --all" deps-unittest: - @helm plugin install https://github.com/helm-unittest/helm-unittest --version=0.3.0 || true + @helm plugin install https://github.com/helm-unittest/helm-unittest --version=0.3.3 || true unittest: deps-unittest find ./charts -name "Chart.yaml" | \ diff --git a/charts/admission-controller/tests/label_test.yaml b/charts/admission-controller/tests/label_test.yaml index 6ab1dab5e..b56d3193c 100644 --- a/charts/admission-controller/tests/label_test.yaml +++ b/charts/admission-controller/tests/label_test.yaml @@ -99,10 +99,10 @@ tests: labels: "my.label/key1: " clusterName: test-k8s asserts: - - isNull: + - isEmpty: path: metadata.labels['my.label/key1'] template: scanner/deployment.yaml - - isNull: + - isEmpty: path: metadata.labels['my.label/key1'] template: webhook/deployment.yaml @@ -161,7 +161,7 @@ tests: clusterName: test-k8s template: scanner/deployment.yaml asserts: - - isNull: + - isEmpty: path: metadata.labels['my.label/key1'] - it: check application of incorrect admission controller scanner labels with yaml @@ -221,7 +221,7 @@ tests: clusterName: test-k8s template: webhook/deployment.yaml asserts: - - isNull: + - isEmpty: path: metadata.labels['my.label/key1'] - it: check application of incorrect admission controller webhook labels with yaml diff --git a/charts/agent/tests/conditional_flag_test.yaml b/charts/agent/tests/conditional_flag_test.yaml index 351792657..31729d66c 100644 --- a/charts/agent/tests/conditional_flag_test.yaml +++ b/charts/agent/tests/conditional_flag_test.yaml @@ -11,9 +11,9 @@ tests: - equal: path: spec.template.metadata.annotations['autopilot.gke.io/no-connect'] value: "true" - - isNull: + - isNullOrEmpty: path: spec.template.spec.affinity - - isNull: + - isEmpty: path: spec.template.spec.initContainers[0].env[?(@.name == "SYSDIG_BPF_PROBE")].value - equal: path: spec.template.spec.initContainers[*].volumeMounts[?(@.name == "bpf-probes")].mountPath diff --git a/charts/agent/tests/label_test.yaml b/charts/agent/tests/label_test.yaml index d261ddf01..96b08c8bb 100644 --- a/charts/agent/tests/label_test.yaml +++ b/charts/agent/tests/label_test.yaml @@ -52,7 +52,7 @@ tests: daemonset: labels: "my.label/key1: " asserts: - - isNull: + - isEmpty: path: metadata.labels['my.label/key1'] - it: check application of incorrect agent labels with yaml set: diff --git a/charts/sysdig-deploy/tests/notes_test.yaml b/charts/sysdig-deploy/tests/notes_test.yaml index 3e11281b5..45d0642e9 100644 --- a/charts/sysdig-deploy/tests/notes_test.yaml +++ b/charts/sysdig-deploy/tests/notes_test.yaml @@ -465,6 +465,9 @@ tests: global: sysdig: region: ap3 + # TODO: This is required to have the test pass, need more investigation on the reason why agent.enabled=false is required + agent: + enabled: false asserts: - failedTemplate: errorMessage: "raw: global.sysdig.region=ap3 provided is not recognized."