Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gionn committed Jan 5, 2023
1 parent 65260df commit 8f18872
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ suite: test reindexing job manifest
templates:
- reindexing-job.yaml
tests:
- it: should have env vars for spring database credentials
- it: should have env vars for spring database credentials referencing the main chart secret
values: &testvalues
- ../../../tests/values/test_values.yaml
asserts:
Expand All @@ -13,6 +13,23 @@ tests:
- equal:
path: spec.template.spec.containers[0].env[1].name
value: SPRING_DATASOURCE_USERNAME
- equal:
path: spec.template.spec.containers[0].env[0].valueFrom.secretKeyRef.name
value: RELEASE-NAME-alfresco-cs-dbsecret
- equal:
path: spec.template.spec.containers[0].env[1].valueFrom.secretKeyRef.name
value: RELEASE-NAME-alfresco-cs-dbsecret
- it: should have overridden secret for spring database credentials when existingSecretName is set
values: *testvalues
set:
reindexing.postgresql.existingSecretName: my-custom-secret
asserts:
- equal:
path: spec.template.spec.containers[0].env[0].valueFrom.secretKeyRef.name
value: my-custom-secret
- equal:
path: spec.template.spec.containers[0].env[1].valueFrom.secretKeyRef.name
value: my-custom-secret
- it: should not be present when disabled
values: *testvalues
set:
Expand Down
35 changes: 35 additions & 0 deletions helm/alfresco-content-services/tests/secret-database_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
suite: test database secret manifest
templates:
- secret-database.yaml
tests:
- it: should have secrets set with default values
values: &testvalues
- values/test_values.yaml
asserts:
- equal:
path: data.DATABASE_USERNAME
value: YWxmcmVzY28=
- equal:
path: data.DATABASE_USERNAME
value: YWxmcmVzY28=
- it: should not have a secret manifest at all when existingSecretName is set
values: *testvalues
set:
postgresql.existingSecretName: whatever
asserts:
- hasDocuments:
count: 0
- it: should override credentials when `database.*` are set
values: *testvalues
set:
database:
user: mycustomadmin
password: mycustompassword
asserts:
- equal:
path: data.DATABASE_USERNAME
value: bXljdXN0b21hZG1pbg==
- equal:
path: data.DATABASE_USERNAME
value: bXljdXN0b21hZG1pbg==

0 comments on commit 8f18872

Please sign in to comment.