Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(acme): fix templating and add unit tests (#655) #715

Merged
merged 3 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/acme/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: An acme settings chart for Jenkins infra project
name: acme
version: 0.1.2
version: 0.1.3
home: "https://github.com/jenkins-infra/charts"
maintainers:
- name: Olblak
Expand Down
2 changes: 2 additions & 0 deletions charts/acme/templates/clusterIssuer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ spec:
privateKeySecretRef:
# Secret resource used to store the account's private key.
name: {{ .Values.acme.id }}
{{- if .Values.acme.solvers }}
solvers:
{{- toYaml .Values.acme.solvers | nindent 4 }}
{{- end}}
23 changes: 23 additions & 0 deletions charts/acme/tests/defaults_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
suite: default tests
values:
- ../values.yaml
- secrets_default_values.yaml
linoleparquet marked this conversation as resolved.
Show resolved Hide resolved
templates:
- clusterIssuer.yaml
- secret.yaml
tests:
- it: should create a cluster issuer by default
template: clusterIssuer.yaml
asserts:
- hasDocuments:
count: 1
- it: should create a Secret with the correct value
template: secret.yaml
asserts:
- hasDocuments:
count: 1
- isKind:
of: Secret
- equal:
path: data.CLIENT_SECRET
value: cGFzc3dvcmQ=
4 changes: 4 additions & 0 deletions charts/acme/tests/secrets_default_values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
acme:
clientSecrets:
- name: acme-test-secret
value: password
4 changes: 2 additions & 2 deletions charts/acme/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ acme:

# Secrets used for dns01 settings
clientSecrets:
- name: 'acme_test_secret'
value: 'password'
- name: acme-test-secret
value: ""

# Accepts any values as defined here https://cert-manager.io/docs/configuration/acme/dns01/
dns01: {}