diff --git a/helm/flowforge/tests/deployment_test.yaml b/helm/flowforge/tests/deployment_test.yaml new file mode 100644 index 00000000..37f1326c --- /dev/null +++ b/helm/flowforge/tests/deployment_test.yaml @@ -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 \ No newline at end of file diff --git a/helm/flowforge/tests/secrets_test.yaml b/helm/flowforge/tests/secrets_test.yaml index 83a508a4..0fc5b9a6 100644 --- a/helm/flowforge/tests/secrets_test.yaml +++ b/helm/flowforge/tests/secrets_test.yaml @@ -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: sender@example.com + 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: sender@example.com + 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: sender@example.com + 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: sender@example.com + smtp: + host: smtp.gmail.com + existingSecret: "fake-existing-smtp-secret" asserts: - hasDocuments: count: 0