Skip to content

Commit

Permalink
fix(ldap): fix helm templating and add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
linoleparquet committed Nov 1, 2023
1 parent 098f530 commit 2ccf53e
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/ldap/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ description: A Helm chart for ldap.jenkins.io
maintainers:
- name: olblak
name: ldap
version: 0.2.0
version: 0.2.1
22 changes: 22 additions & 0 deletions charts/ldap/tests/custom_values_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
suite: Test with custom values
templates:
- secret.yaml
tests:
- it: should create a Secret with the correct value
set:
ldap:
storage:
accountname: name
accountkey: key
template: secret.yaml
asserts:
- hasDocuments:
count: 1
- isKind:
of: Secret
- equal:
path: data.azurestorageaccountname
value: bmFtZQ==
- equal:
path: data.azurestorageaccountkey
value: a2V5
45 changes: 45 additions & 0 deletions charts/ldap/tests/defaults_values_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
suite: Test with default values
templates:
- certificate.yaml
- persistentVolumeClaim.yaml
tests:
- it: should create a certificate for the dns ldap.jenkins.io
template: certificate.yaml
asserts:
- hasDocuments:
count: 1
- contains:
path: spec.dnsNames
content:
ldap.jenkins.io
- isKind:
of: Certificate
- it: should create 2 PVC, one for data, one for backup
template: persistentVolumeClaim.yaml
asserts:
- hasDocuments:
count: 2
- isKind:
of: PersistentVolumeClaim
documentIndex: 0
- isKind:
of: PersistentVolumeClaim
documentIndex: 1
- it: should create 1 PVC for backup
template: persistentVolumeClaim.yaml
asserts:
- equal:
path: spec.selector.matchLabels.role
value: ldap-backup
documentIndex: 0
- equal:
path: metadata.name
value: RELEASE-NAME-ldap-backup
documentIndex: 0
- it: should create 1 PVC for data
template: persistentVolumeClaim.yaml
asserts:
- equal:
path: metadata.name
value: RELEASE-NAME-ldap-data
documentIndex: 1
3 changes: 3 additions & 0 deletions charts/ldap/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ ldap:
key:
filename: privkey.key
value: ''
storage:
accountname: account-name
accountkey: account-key
podSecurityContext: {}
# fsGroup: 2000

Expand Down

0 comments on commit 2ccf53e

Please sign in to comment.