Skip to content

Commit

Permalink
feature(admission-controller,agent): update the unittest plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
mavimo committed Jul 24, 2023
1 parent 12a3330 commit 89e5a46
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/helm-unit-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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" | \
Expand Down
8 changes: 4 additions & 4 deletions charts/admission-controller/tests/label_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions charts/agent/tests/conditional_flag_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion charts/agent/tests/label_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions charts/sysdig-deploy/tests/notes_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit 89e5a46

Please sign in to comment.