-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add deployment and secrets unit tests
- Loading branch information
1 parent
64a76c9
commit 52c1b0a
Showing
2 changed files
with
60 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json | ||
suite: test deployment object | ||
templates: | ||
- deployment.yaml | ||
set: | ||
forge.domain: "chart-unit-tests.com" | ||
tests: | ||
- it: should create a deployment | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: Deployment | ||
- it: should create a deployment with init container | ||
asserts: | ||
- isNotNullOrEmpty: | ||
path: spec.template.spec.initContainers | ||
- lengthEqual: | ||
path: spec.template.spec.initContainers | ||
count: 1 | ||
|
||
- it: should create an init container with two secrets | ||
asserts: | ||
- isNotNullOrEmpty: | ||
path: spec.template.spec.initContainers[0].env | ||
- lengthEqual: | ||
path: spec.template.spec.initContainers[0].env | ||
count: 2 | ||
- equal: | ||
path: spec.template.spec.initContainers[0].env[0].name | ||
value: PGPASSWORD | ||
- equal: | ||
path: spec.template.spec.initContainers[0].env[1].name | ||
value: SMTPPASSWORD | ||
- equal: | ||
path: spec.template.spec.initContainers[0].env[*].valueFrom.secretKeyRef.name | ||
value: flowfuse-secrets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json | ||
suite: test secrets object | ||
templates: | ||
- secrets.yaml | ||
set: | ||
forge.domain: "chart-unit-tests.com" | ||
tests: | ||
- it: should create a secret object | ||
set: | ||
forge.domain: "chart-unit-tests.com" | ||
forge.email.smtp: | ||
host: smtp.gmail.com | ||
password: ut-smtp-password | ||
forge.email: | ||
from: [email protected] | ||
smtp: | ||
host: smtp.gmail.com | ||
password: ut-smtp-password | ||
postgresql.auth: | ||
username: ut-db-username | ||
password: ut-db-password | ||
|
@@ -18,11 +22,12 @@ tests: | |
of: Secret | ||
- it: should create a secret object with smtp password only | ||
set: | ||
forge.domain: "chart-unit-tests.com" | ||
postgresql.auth.existingSecret: "fake-existing-db-secret" | ||
forge.email.smtp: | ||
host: smtp.gmail.com | ||
password: fakePassword | ||
forge.email: | ||
from: [email protected] | ||
smtp: | ||
host: smtp.gmail.com | ||
password: fakePassword | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
|
@@ -34,13 +39,14 @@ tests: | |
path: data.password | ||
- it: should create a secret object with database password only | ||
set: | ||
forge.domain: "chart-unit-tests.com" | ||
postgresql.auth: | ||
username: ut-db-username | ||
password: ut-db-password | ||
forge.email.smtp: | ||
host: smtp.gmail.com | ||
existingSecret: "fake-existing-smtp-secret" | ||
forge.email: | ||
from: [email protected] | ||
smtp: | ||
host: smtp.gmail.com | ||
existingSecret: "fake-existing-smtp-secret" | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
|
@@ -54,11 +60,12 @@ tests: | |
path: data.smtp-password | ||
- it: should not create the secret if both external ones are used | ||
set: | ||
forge.domain: "chart-unit-tests.com" | ||
postgresql.auth.existingSecret: "fake-existing-db-secret" | ||
forge.email.smtp: | ||
host: smtp.gmail.com | ||
existingSecret: "fake-existing-smtp-secret" | ||
forge.email: | ||
from: [email protected] | ||
smtp: | ||
host: smtp.gmail.com | ||
existingSecret: "fake-existing-smtp-secret" | ||
asserts: | ||
- hasDocuments: | ||
count: 0 |