From ecb60160f5c36345f76df4c45f7de2d027e05d29 Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Wed, 20 Mar 2024 13:13:09 +0100 Subject: [PATCH] OZG-5238 Cleaned Up deployment helm test --- src/test/helm/deployment_database_test.yaml | 28 ++++------------- .../deployment_image_pull_secret_test.yaml | 17 ++++------ src/test/helm/deployment_resources_test.yaml | 11 ++++--- .../helm/deployment_spring_profile_test.yaml | 17 ++++------ src/test/helm/deployment_test.yaml | 31 ++++--------------- src/test/helm/deployment_volume_test.yaml | 19 ++++-------- 6 files changed, 36 insertions(+), 87 deletions(-) diff --git a/src/test/helm/deployment_database_test.yaml b/src/test/helm/deployment_database_test.yaml index 4ef00093..8c747b65 100644 --- a/src/test/helm/deployment_database_test.yaml +++ b/src/test/helm/deployment_database_test.yaml @@ -28,14 +28,14 @@ release: namespace: sh-helm-test templates: - templates/deployment.yaml +set: + ozgcloud: + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: should have a volume for the mongodb certificate - set: - ozgcloud: - bundesland: sh - bezeichner: helm - sso: - serverUrl: https://sso.company.local asserts: - contains: path: spec.template.spec.volumes @@ -45,12 +45,6 @@ tests: secretName: ozg-mongodb-tls-cert optional: true - it: should mount mongodb certificate volume - set: - ozgcloud: - bundesland: sh - bezeichner: helm - sso: - serverUrl: https://sso.company.local asserts: - contains: path: spec.template.spec.containers[0].volumeMounts @@ -61,11 +55,6 @@ tests: readOnly: true - it: should configure internal mongodb if not useExternal set: - ozgcloud: - bundesland: sh - bezeichner: helm - sso: - serverUrl: https://sso.company.local database.useExternal: false asserts: - contains: @@ -84,11 +73,6 @@ tests: value: administration-database - it: should configure external mongodb if useExternal set: - ozgcloud: - bundesland: sh - bezeichner: helm - sso: - serverUrl: https://sso.company.local database.useExternal: true asserts: - contains: diff --git a/src/test/helm/deployment_image_pull_secret_test.yaml b/src/test/helm/deployment_image_pull_secret_test.yaml index 8c526a2c..44f285aa 100644 --- a/src/test/helm/deployment_image_pull_secret_test.yaml +++ b/src/test/helm/deployment_image_pull_secret_test.yaml @@ -27,14 +27,14 @@ templates: release: name: administration namespace: helm-test +set: + ozgcloud: + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: should use default image pull secret - set: - ozgcloud: - bundesland: sh - bezeichner: helm - sso: - serverUrl: https://sso.company.local asserts: - contains: path: spec.template.spec.imagePullSecrets @@ -42,11 +42,6 @@ tests: name: administration-image-pull-secret - it: should use customizable image pull secret set: - ozgcloud: - bundesland: sh - bezeichner: helm - sso: - serverUrl: https://sso.company.local imagePullSecret: custom-image-pull-secret asserts: - contains: diff --git a/src/test/helm/deployment_resources_test.yaml b/src/test/helm/deployment_resources_test.yaml index 3f18ba3a..d37443f2 100644 --- a/src/test/helm/deployment_resources_test.yaml +++ b/src/test/helm/deployment_resources_test.yaml @@ -27,14 +27,15 @@ templates: release: name: administration namespace: helm-test +set: + ozgcloud: + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: should have customizable resources set: - ozgcloud: - bundesland: sh - bezeichner: helm - sso: - serverUrl: https://sso.company.local resources: { "test": 1 } asserts: - equal: diff --git a/src/test/helm/deployment_spring_profile_test.yaml b/src/test/helm/deployment_spring_profile_test.yaml index 3613b3bb..f99d9b98 100644 --- a/src/test/helm/deployment_spring_profile_test.yaml +++ b/src/test/helm/deployment_spring_profile_test.yaml @@ -28,14 +28,15 @@ release: namespace: sh-helm-test templates: - templates/deployment.yaml +set: + ozgcloud: + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: should override the spring profiles set: - ozgcloud: - bundesland: sh - bezeichner: helm - sso: - serverUrl: https://sso.company.local env.overrideSpringProfiles: oc,dev,ea asserts: - isKind: @@ -46,12 +47,6 @@ tests: name: spring_profiles_active value: oc,dev,ea - it: should generate the spring profiles - set: - ozgcloud: - bundesland: sh - bezeichner: helm - sso: - serverUrl: https://sso.company.local asserts: - isKind: of: Deployment diff --git a/src/test/helm/deployment_test.yaml b/src/test/helm/deployment_test.yaml index 1bd39d14..6bd31db1 100644 --- a/src/test/helm/deployment_test.yaml +++ b/src/test/helm/deployment_test.yaml @@ -28,15 +28,14 @@ release: templates: - templates/deployment.yaml set: - ozgcloud.environment: "default" + ozgcloud: + environment: "default" + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: should have metadata values - set: - ozgcloud: - bundesland: sh - bezeichner: helm - sso: - serverUrl: https://sso.company.local asserts: - isKind: of: Deployment @@ -49,12 +48,6 @@ tests: - exists: path: metadata.labels - it: should have correct general settings - set: - ozgcloud: - bundesland: sh - bezeichner: helm - sso: - serverUrl: https://sso.company.local asserts: - equal: path: spec.progressDeadlineSeconds @@ -83,12 +76,6 @@ tests: path: spec.strategy.type value: "RollingUpdate" - it: should have correct template configuration - set: - ozgcloud: - bundesland: sh - bezeichner: helm - sso: - serverUrl: https://sso.company.local asserts: - equal: path: spec.template.metadata.labels["app.kubernetes.io/instance"] @@ -128,12 +115,6 @@ tests: path: spec.template.spec.terminationGracePeriodSeconds value: 300000000 - it: should have correct container configuration - set: - ozgcloud: - bundesland: sh - bezeichner: helm - sso: - serverUrl: https://sso.company.local asserts: - equal: path: spec.template.spec.containers[0].name diff --git a/src/test/helm/deployment_volume_test.yaml b/src/test/helm/deployment_volume_test.yaml index ef1951a4..6546763a 100644 --- a/src/test/helm/deployment_volume_test.yaml +++ b/src/test/helm/deployment_volume_test.yaml @@ -29,15 +29,14 @@ templates: - templates/deployment.yaml set: Release.Name: "administration" - ozgcloud.environment: "default" + ozgcloud: + environment: "default" + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: should have volumeMounts on it's container - set: - ozgcloud: - bundesland: sh - bezeichner: helm - sso: - serverUrl: https://sso.company.local asserts: - equal: path: spec.template.spec.containers[0].volumeMounts[0].name @@ -64,12 +63,6 @@ tests: path: spec.template.spec.containers[0].volumeMounts[1].readOnly value: true - it: should have volumes on it's spec - set: - ozgcloud: - bundesland: sh - bezeichner: helm - sso: - serverUrl: https://sso.company.local asserts: - equal: path: spec.template.spec.volumes[0].name -- GitLab