Skip to content

Commit 59c6d8e

Browse files
committed
fix template error && add unittest for trivy db repository
Signed-off-by: my036811 <miner.yang@broadcom.com>
1 parent 63e13f8 commit 59c6d8e

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

templates/trivy/trivy-sts.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ spec:
103103
- name: "SCANNER_TRIVY_SKIP_JAVA_DB_UPDATE"
104104
value: {{ .Values.trivy.skipJavaDBUpdate | default false | quote }}
105105
- name: "SCANNER_TRIVY_DB_REPOSITORY"
106-
value: {{ .Values.trivy.dbRepository | join \",\" | quote }}
106+
value: {{ .Values.trivy.dbRepository | join "," | quote }}
107107
- name: "SCANNER_TRIVY_JAVA_DB_REPOSITORY"
108-
value: {{ .Values.trivy.javaDBRepository | join \",\" | quote }}
108+
value: {{ .Values.trivy.javaDBRepository | join "," | quote }}
109109
- name: "SCANNER_TRIVY_OFFLINE_SCAN"
110110
value: {{ .Values.trivy.offlineScan | default false | quote }}
111111
- name: "SCANNER_TRIVY_SECURITY_CHECKS"

test/unittest/trivy/trivy_statefulset_test.yaml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,23 @@ tests:
9494
path: spec.template.spec.volumes
9595
count: 2
9696
- notExists:
97-
path: spec.volumeClaimTemplates
97+
path: spec.volumeClaimTemplates
98+
99+
- it: TrivyDBRepository
100+
set:
101+
trivy:
102+
enabled: true
103+
template: templates/trivy/trivy-sts.yaml
104+
asserts:
105+
- equal:
106+
path: spec.template.spec.containers[0].env[14].value
107+
value: "mirror.gcr.io/aquasec/trivy-db,ghcr.io/aquasecurity/trivy-db"
108+
- equal:
109+
path: spec.template.spec.containers[0].env[14].name
110+
value: "SCANNER_TRIVY_DB_REPOSITORY"
111+
- equal:
112+
path: spec.template.spec.containers[0].env[15].value
113+
value: "mirror.gcr.io/aquasec/trivy-java-db,ghcr.io/aquasecurity/trivy-java-db"
114+
- equal:
115+
path: spec.template.spec.containers[0].env[15].name
116+
value: "SCANNER_TRIVY_JAVA_DB_REPOSITORY"

0 commit comments

Comments
 (0)