diff --git a/run_helm_test.sh b/run_helm_test.sh index 4395f394251c1a3a67b84c3fee710763146e55b3..30f96ffa008eada74acd1bbe8ddd6be43ff57019 100755 --- a/run_helm_test.sh +++ b/run_helm_test.sh @@ -5,4 +5,4 @@ set -x helm template ./src/main/helm/ -f src/test/helm-linter-values.yaml helm lint -f src/test/helm-linter-values.yaml ./src/main/helm/ -cd src/main/helm && helm unittest -f '../../test/helm/*.yaml' . \ No newline at end of file +cd src/main/helm && helm unittest -f '../../test/helm/**/*test.yaml' . \ No newline at end of file diff --git a/src/main/helm/templates/keycloak-client-crd.yaml b/src/main/helm/templates/keycloak_client_crd.yaml similarity index 100% rename from src/main/helm/templates/keycloak-client-crd.yaml rename to src/main/helm/templates/keycloak_client_crd.yaml diff --git a/src/main/helm/templates/keycloak-crd.yaml b/src/main/helm/templates/keycloak_crd.yaml similarity index 100% rename from src/main/helm/templates/keycloak-crd.yaml rename to src/main/helm/templates/keycloak_crd.yaml diff --git a/src/main/helm/templates/keycloak-group-crd.yaml b/src/main/helm/templates/keycloak_group_crd.yaml similarity index 100% rename from src/main/helm/templates/keycloak-group-crd.yaml rename to src/main/helm/templates/keycloak_group_crd.yaml diff --git a/src/main/helm/templates/keycloak-user-crd.yaml b/src/main/helm/templates/keycloak_user_crd.yaml similarity index 100% rename from src/main/helm/templates/keycloak-user-crd.yaml rename to src/main/helm/templates/keycloak_user_crd.yaml diff --git a/src/test/bindings_type_configmap_test.yaml b/src/test/helm/bindings_type_configmap_test.yaml similarity index 94% rename from src/test/bindings_type_configmap_test.yaml rename to src/test/helm/bindings_type_configmap_test.yaml index da77e60e93df1637cd2fab6703d9c9f6f5fbc0cd..938219535005127bba9ec12d7943a7976e0838d1 100644 --- a/src/test/bindings_type_configmap_test.yaml +++ b/src/test/helm/bindings_type_configmap_test.yaml @@ -33,9 +33,11 @@ tests: asserts: - isKind: of: ConfigMap + - isAPIVersion: + of: v1 - equal: path: metadata.name - value: bindings-type + value: alfa-bindings-type - equal: path: metadata.namespace value: sh-helm-test diff --git a/src/test/helm/deployment_actuator_test.yaml b/src/test/helm/deployment_actuator_test.yaml new file mode 100644 index 0000000000000000000000000000000000000000..cdb9a196182f2b7a85c6ed1e3852f3124bd42fd4 --- /dev/null +++ b/src/test/helm/deployment_actuator_test.yaml @@ -0,0 +1,69 @@ +# +# Copyright (C) 2024 Das Land Schleswig-Holstein vertreten durch den +# Ministerpräsidenten des Landes Schleswig-Holstein +# Staatskanzlei +# Abteilung Digitalisierung und zentrales IT-Management der Landesregierung +# +# Lizenziert unter der EUPL, Version 1.2 oder - sobald +# diese von der Europäischen Kommission genehmigt wurden - +# Folgeversionen der EUPL ("Lizenz"); +# Sie dürfen dieses Werk ausschließlich gemäß +# dieser Lizenz nutzen. +# Eine Kopie der Lizenz finden Sie hier: +# +# https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12 +# +# Sofern nicht durch anwendbare Rechtsvorschriften +# gefordert oder in schriftlicher Form vereinbart, wird +# die unter der Lizenz verbreitete Software "so wie sie +# ist", OHNE JEGLICHE GEWÄHRLEISTUNG ODER BEDINGUNGEN - +# ausdrücklich oder stillschweigend - verbreitet. +# Die sprachspezifischen Genehmigungen und Beschränkungen +# unter der Lizenz sind dem Lizenztext zu entnehmen. +# + +suite: test deployment actuator +release: + name: alfa + namespace: sh-helm-test +templates: + - templates/deployment.yaml +set: + baseUrl: test.company.local + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local + imagePullSecret: test-image-pull-secret +tests: + - it: check readiness and startup probe + asserts: + - equal: + path: spec.template.spec.containers[0].readinessProbe + value: + failureThreshold: 3 + httpGet: + path: /actuator/health/readiness + port: 8081 + scheme: HTTP + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 3 + + - equal: + path: spec.template.spec.containers[0].startupProbe + value: + failureThreshold: 10 + httpGet: + path: /actuator/health/readiness + port: 8081 + scheme: HTTP + initialDelaySeconds: 30 + periodSeconds: 5 + successThreshold: 1 + timeoutSeconds: 5 + + + diff --git a/src/test/helm/deployment_container_basic_test.yaml b/src/test/helm/deployment_container_basic_test.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d1825339f2f7ece7ce6f153871034fa8874bdf09 --- /dev/null +++ b/src/test/helm/deployment_container_basic_test.yaml @@ -0,0 +1,64 @@ +# +# Copyright (C) 2024 Das Land Schleswig-Holstein vertreten durch den +# Ministerpräsidenten des Landes Schleswig-Holstein +# Staatskanzlei +# Abteilung Digitalisierung und zentrales IT-Management der Landesregierung +# +# Lizenziert unter der EUPL, Version 1.2 oder - sobald +# diese von der Europäischen Kommission genehmigt wurden - +# Folgeversionen der EUPL ("Lizenz"); +# Sie dürfen dieses Werk ausschließlich gemäß +# dieser Lizenz nutzen. +# Eine Kopie der Lizenz finden Sie hier: +# +# https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12 +# +# Sofern nicht durch anwendbare Rechtsvorschriften +# gefordert oder in schriftlicher Form vereinbart, wird +# die unter der Lizenz verbreitete Software "so wie sie +# ist", OHNE JEGLICHE GEWÄHRLEISTUNG ODER BEDINGUNGEN - +# ausdrücklich oder stillschweigend - verbreitet. +# Die sprachspezifischen Genehmigungen und Beschränkungen +# unter der Lizenz sind dem Lizenztext zu entnehmen. +# + +suite: test deployment container basics +release: + name: alfa + namespace: sh-helm-test +templates: + - templates/deployment.yaml +set: + baseUrl: test.company.local + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local +tests: + - it: should have correct values for container image, name, imagePullPolicy + asserts: + - equal: + path: spec.template.spec.containers[0].image + value: docker.ozg-sh.de/alfa:latest + - equal: + path: spec.template.spec.containers[0].name + value: alfa + - equal: + path: spec.template.spec.containers[0].imagePullPolicy + value: Always + - it: should have correct values for container ports + asserts: + - contains: + path: spec.template.spec.containers[0].ports + content: + containerPort: 8080 + name: 8080tcp1 + protocol: TCP + - contains: + path: spec.template.spec.containers[0].ports + content: + containerPort: 8081 + name: metrics + protocol: TCP \ No newline at end of file diff --git a/src/test/helm/deployment_container_other_values_test.yaml b/src/test/helm/deployment_container_other_values_test.yaml new file mode 100644 index 0000000000000000000000000000000000000000..5a5644e3c7db29f4ad813452a43be24b461708a6 --- /dev/null +++ b/src/test/helm/deployment_container_other_values_test.yaml @@ -0,0 +1,54 @@ + + # +# Copyright (C) 2024 Das Land Schleswig-Holstein vertreten durch den +# Ministerpräsidenten des Landes Schleswig-Holstein +# Staatskanzlei +# Abteilung Digitalisierung und zentrales IT-Management der Landesregierung +# +# Lizenziert unter der EUPL, Version 1.2 oder - sobald +# diese von der Europäischen Kommission genehmigt wurden - +# Folgeversionen der EUPL ("Lizenz"); +# Sie dürfen dieses Werk ausschließlich gemäß +# dieser Lizenz nutzen. +# Eine Kopie der Lizenz finden Sie hier: +# +# https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12 +# +# Sofern nicht durch anwendbare Rechtsvorschriften +# gefordert oder in schriftlicher Form vereinbart, wird +# die unter der Lizenz verbreitete Software "so wie sie +# ist", OHNE JEGLICHE GEWÄHRLEISTUNG ODER BEDINGUNGEN - +# ausdrücklich oder stillschweigend - verbreitet. +# Die sprachspezifischen Genehmigungen und Beschränkungen +# unter der Lizenz sind dem Lizenztext zu entnehmen. +# + +suite: test deployment container other values +release: + name: alfa + namespace: sh-helm-test +templates: + - templates/deployment.yaml +set: + baseUrl: test.company.local + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local +tests: + - it: should have correct values for container terminationMessagePolicy, terminationMessagePath, stdin, tty + asserts: + - equal: + path: spec.template.spec.containers[0].terminationMessagePolicy + value: File + - equal: + path: spec.template.spec.containers[0].terminationMessagePath + value: /dev/termination-log + - equal: + path: spec.template.spec.containers[0].stdin + value: true + - equal: + path: spec.template.spec.containers[0].tty + value: true \ No newline at end of file diff --git a/src/test/helm/deployment_env_test.yaml b/src/test/helm/deployment_customList_env_test.yaml similarity index 96% rename from src/test/helm/deployment_env_test.yaml rename to src/test/helm/deployment_customList_env_test.yaml index 4846e3c79c13c350e2ab024cd299a9485a5cafe2..f9b21c10af1c216a64251ef348b3445cd9c2985b 100644 --- a/src/test/helm/deployment_env_test.yaml +++ b/src/test/helm/deployment_customList_env_test.yaml @@ -35,7 +35,6 @@ set: serverUrl: https://sso.company.local tests: - it: check customList - template: deployment.yaml set: env.customList: - name: my_test_environment_name @@ -47,7 +46,6 @@ tests: name: my_test_environment_name value: "A test value" - it: check customList test value is not set by default - template: deployment.yaml asserts: - notContains: path: spec.template.spec.containers[0].env diff --git a/src/test/helm/deployment_defaults_affinity_test.yaml b/src/test/helm/deployment_defaults_affinity_test.yaml index 66ff5b228bb2f35b96e77f04c076fb4212fe3181..a4dc69679a6040699598e22f5058ddbd87602d84 100644 --- a/src/test/helm/deployment_defaults_affinity_test.yaml +++ b/src/test/helm/deployment_defaults_affinity_test.yaml @@ -39,8 +39,6 @@ set: tests: - it: should work asserts: - - isKind: - of: Deployment - equal: path: spec.template.spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms[0].matchExpressions[0].key value: alfaable diff --git a/src/test/helm/deployment_defaults_env_test.yaml b/src/test/helm/deployment_defaults_env_test.yaml index fda55d0d9709557a9b2139a441871ec421c9f261..d05433875978be7d261520a5904c904c78519dda 100644 --- a/src/test/helm/deployment_defaults_env_test.yaml +++ b/src/test/helm/deployment_defaults_env_test.yaml @@ -70,8 +70,6 @@ tests: value: "/bindings" - it: should have user assistance documentation url - templates: - - templates/deployment.yaml set: ozgcloud: user_assistance: @@ -88,8 +86,6 @@ tests: value: http:// - it: should have create Bescheid Konfiguration - templates: - - templates/deployment.yaml set: ozgcloud: environment: test diff --git a/src/test/helm/deployment_defaults_labels_test.yaml b/src/test/helm/deployment_defaults_labels_test.yaml index 635f86e602a7c26d6f3acf5d9070c09d67d7cd83..ddd045f50e790add110dc55d9b60484d25ee3365 100644 --- a/src/test/helm/deployment_defaults_labels_test.yaml +++ b/src/test/helm/deployment_defaults_labels_test.yaml @@ -28,8 +28,7 @@ release: namespace: sh-helm-test templates: - templates/deployment.yaml - - templates/service_monitor.yaml - - templates/service.yaml + set: baseUrl: test.company.local ozgcloud: diff --git a/src/test/helm/deployment_defaults_spec_containers_health_test.yaml b/src/test/helm/deployment_defaults_spec_containers_health_test.yaml index b159900bff56d1bbb987e65f4a889e8a3174043e..352d15468571d4b60c1d512dccc5b597718ffa71 100644 --- a/src/test/helm/deployment_defaults_spec_containers_health_test.yaml +++ b/src/test/helm/deployment_defaults_spec_containers_health_test.yaml @@ -39,8 +39,6 @@ set: tests: - it: should work asserts: - - isKind: - of: Deployment - equal: path: spec.template.spec.containers[0].readinessProbe.failureThreshold value: 3 diff --git a/src/test/helm/deployment_defaults_spec_containers_securityContext_test.yaml b/src/test/helm/deployment_defaults_spec_containers_securityContext_test.yaml index 21f10f7c84bed9a48cd8079bb262d83ba5d275d2..ebb235df4d123a8ec9084dcf3f0b952b7425a971 100644 --- a/src/test/helm/deployment_defaults_spec_containers_securityContext_test.yaml +++ b/src/test/helm/deployment_defaults_spec_containers_securityContext_test.yaml @@ -39,8 +39,6 @@ set: tests: - it: check default values asserts: - - isKind: - of: Deployment - equal: path: spec.template.spec.containers[0].securityContext.allowPrivilegeEscalation value: false diff --git a/src/test/helm/deployment_defaults_spec_containers_test.yaml b/src/test/helm/deployment_defaults_spec_containers_test.yaml index 20acbea4b6ae97414f7d972b34a8cf0bd71c3abd..eab9e59cd25e98e7455e5cc48e235eed0c11a2dc 100644 --- a/src/test/helm/deployment_defaults_spec_containers_test.yaml +++ b/src/test/helm/deployment_defaults_spec_containers_test.yaml @@ -39,8 +39,6 @@ set: tests: - it: check for some standard values asserts: - - isKind: - of: Deployment - equal: path: spec.template.spec.containers[0].image value: "docker.ozg-sh.de/alfa:latest" diff --git a/src/test/helm/deployment_defaults_sso_test.yaml b/src/test/helm/deployment_defaults_sso_env_test.yaml similarity index 97% rename from src/test/helm/deployment_defaults_sso_test.yaml rename to src/test/helm/deployment_defaults_sso_env_test.yaml index 9577a9a015b53b10ccef145cf98e030ddc9271e0..9f75b449b20085d377ae25383a05f0df3fc42f94 100644 --- a/src/test/helm/deployment_defaults_sso_test.yaml +++ b/src/test/helm/deployment_defaults_sso_env_test.yaml @@ -22,7 +22,7 @@ # unter der Lizenz sind dem Lizenztext zu entnehmen. # -suite: test deployment +suite: test deployment sso release: name: alfa namespace: sh-helm-test @@ -39,8 +39,6 @@ set: tests: - it: check default values asserts: - - isKind: - of: Deployment - contains: path: spec.template.spec.containers[0].env content: diff --git a/src/test/helm/deployment_defaults_topologySpreadConstraints_test.yaml b/src/test/helm/deployment_defaults_topologySpreadConstraints_test.yaml index 3dadf673fef8847b578fe2ca025299f644e73ef6..8c5547b0e334fcae1fbd8b7a582faa89d2bf9460 100644 --- a/src/test/helm/deployment_defaults_topologySpreadConstraints_test.yaml +++ b/src/test/helm/deployment_defaults_topologySpreadConstraints_test.yaml @@ -22,7 +22,7 @@ # unter der Lizenz sind dem Lizenztext zu entnehmen. # -suite: test deployment +suite: test deployment topology release: name: alfa namespace: sh-helm-test @@ -39,8 +39,6 @@ set: tests: - it: check default values asserts: - - isKind: - of: Deployment - equal: path: spec.template.spec.topologySpreadConstraints[0].maxSkew value: 1 diff --git a/src/test/helm/deployment_imageTag_test.yaml b/src/test/helm/deployment_imageTag_test.yaml index 24eb6cd05e11e779ed033459c444e35b9a8d84a7..ba61fa1901b1a639dc3a4357b43a129578dc2b1d 100644 --- a/src/test/helm/deployment_imageTag_test.yaml +++ b/src/test/helm/deployment_imageTag_test.yaml @@ -41,8 +41,6 @@ tests: set: image.tag: latest asserts: - - isKind: - of: Deployment - equal: path: spec.template.spec.containers[0].image value: docker.ozg-sh.de/alfa:latest \ No newline at end of file diff --git a/src/test/helm/deployment_imagepull_secret_test.yaml b/src/test/helm/deployment_imagepull_secret_test.yaml index 376a207a28cdae5b39cf7bafac1e37cc2ff3e7dd..adce4030395ad9ac3b0fe402fe9abfdf0c16df81 100644 --- a/src/test/helm/deployment_imagepull_secret_test.yaml +++ b/src/test/helm/deployment_imagepull_secret_test.yaml @@ -39,8 +39,6 @@ set: tests: - it: should use default imagePull secret asserts: - - isKind: - of: Deployment - equal: path: spec.template.spec.imagePullSecrets[0].name value: alfa-image-pull-secret @@ -48,8 +46,6 @@ tests: set: imagePullSecret: image-pull-secret asserts: - - isKind: - of: Deployment - equal: path: spec.template.spec.imagePullSecrets[0].name value: image-pull-secret \ No newline at end of file diff --git a/src/test/helm/deployment_liveness_probe_test.yaml b/src/test/helm/deployment_liveness_probe_test.yaml index c40f218f962f0616b196a8d49b6f52fb4800223d..fcc854efa2a0c8456656432d7461fa7eee332bc7 100644 --- a/src/test/helm/deployment_liveness_probe_test.yaml +++ b/src/test/helm/deployment_liveness_probe_test.yaml @@ -44,7 +44,6 @@ tests: path: spec.template.spec.containers[0].livenessProbe - it: enable livenessProbe - template: deployment.yaml set: enableLivenessProbe: true asserts: @@ -59,3 +58,7 @@ tests: periodSeconds: 10 successThreshold: 1 timeoutSeconds: 3 + - it: not enable livenessProbe by default + asserts: + - isNull: + path: spec.template.spec.containers[0].livenessProbe \ No newline at end of file diff --git a/src/test/helm/deployment_pluto_address_test.yaml b/src/test/helm/deployment_pluto_address_test.yaml index f29d2a1019908ba8ee3605e3c801b7aa56a8b6ad..5058818e1d1207a10c0eed2c00231ac5ebb0e840 100644 --- a/src/test/helm/deployment_pluto_address_test.yaml +++ b/src/test/helm/deployment_pluto_address_test.yaml @@ -22,7 +22,7 @@ # unter der Lizenz sind dem Lizenztext zu entnehmen. # -suite: test deployment +suite: test deployment pluto address release: name: alfa namespace: sh-helm-test diff --git a/src/test/helm/deployment_replicas_test.yaml b/src/test/helm/deployment_pod_default_spec_values_test.yaml similarity index 65% rename from src/test/helm/deployment_replicas_test.yaml rename to src/test/helm/deployment_pod_default_spec_values_test.yaml index a02796b0fec4d2890f7ab161c239be1d4483e31a..0ff87d737de43f51e90b084af567ded5b6bd7806 100644 --- a/src/test/helm/deployment_replicas_test.yaml +++ b/src/test/helm/deployment_pod_default_spec_values_test.yaml @@ -1,5 +1,5 @@ -# -# Copyright (C) 2022 Das Land Schleswig-Holstein vertreten durch den + # +# Copyright (C) 2024 Das Land Schleswig-Holstein vertreten durch den # Ministerpräsidenten des Landes Schleswig-Holstein # Staatskanzlei # Abteilung Digitalisierung und zentrales IT-Management der Landesregierung @@ -22,13 +22,13 @@ # unter der Lizenz sind dem Lizenztext zu entnehmen. # -suite: test deployment +suite: test deployment container basics release: name: alfa namespace: sh-helm-test templates: - templates/deployment.yaml -set: +set: baseUrl: test.company.local ozgcloud: environment: test @@ -37,12 +37,19 @@ set: sso: serverUrl: https://sso.company.local tests: - - it: should set the replica count - set: - replicaCount: 10 - asserts: - - isKind: - of: Deployment + - it: should have correct pod template values + asserts: + - isEmpty: + path: spec.template.spec.dnsConfig + - equal: + path: spec.template.spec.dnsPolicy + value: "ClusterFirst" + - equal: + path: spec.template.spec.restartPolicy + value: "Always" + - equal: + path: spec.template.spec.schedulerName + value: "default-scheduler" - equal: - path: spec.replicas - value: 10 \ No newline at end of file + path: spec.template.spec.terminationGracePeriodSeconds + value: 30 \ No newline at end of file diff --git a/src/test/helm/deployment_realm_name_length_test.yaml b/src/test/helm/deployment_realm_name_length_test.yaml index 8305d800d7d5c5ca3afca6acc2d5f6a6fe0f2bb1..f5e8eb3ed6980f3051fc18cacdd3b24c04fd4206 100644 --- a/src/test/helm/deployment_realm_name_length_test.yaml +++ b/src/test/helm/deployment_realm_name_length_test.yaml @@ -31,7 +31,6 @@ templates: tests: - it: should fail on bezeichner length longer than 46 characters - template: deployment.yaml set: ozgcloud: bezeichner: test1234567890123123456789012345678901234567890123456789012345678901234567890123456789012345678904567890 diff --git a/src/test/helm/deployment_resources_test.yaml b/src/test/helm/deployment_resources_test.yaml index 9ef0c9aa2b91aac31a158da2d1adad978c554ded..2d37c37e05c764be424af6a44b4b27320aa21b80 100644 --- a/src/test/helm/deployment_resources_test.yaml +++ b/src/test/helm/deployment_resources_test.yaml @@ -22,7 +22,7 @@ # unter der Lizenz sind dem Lizenztext zu entnehmen. # -suite: test deployment +suite: test deployment recouces release: name: alfa templates: diff --git a/src/test/helm/deployment_springProfile_test.yaml b/src/test/helm/deployment_springProfile_env_test.yaml similarity index 94% rename from src/test/helm/deployment_springProfile_test.yaml rename to src/test/helm/deployment_springProfile_env_test.yaml index 511917490f577d98164bd4dde37f9b5274d6f81f..780290a1c3205b9978c43958e01195b00815d009 100644 --- a/src/test/helm/deployment_springProfile_test.yaml +++ b/src/test/helm/deployment_springProfile_env_test.yaml @@ -22,7 +22,7 @@ # unter der Lizenz sind dem Lizenztext zu entnehmen. # -suite: test deployment +suite: test deployment spring profile release: name: alfa namespace: sh-helm-test @@ -41,8 +41,6 @@ tests: set: env.overrideSpringProfiles: oc,test,ea asserts: - - isKind: - of: Deployment - contains: path: spec.template.spec.containers[0].env content: @@ -50,8 +48,6 @@ tests: value: oc,test,ea - it: should generate the spring profiles asserts: - - isKind: - of: Deployment - contains: path: spec.template.spec.containers[0].env content: diff --git a/src/test/helm/deployment_usermanager_address_test.yaml b/src/test/helm/deployment_usermanager_address_env_test.yaml similarity index 97% rename from src/test/helm/deployment_usermanager_address_test.yaml rename to src/test/helm/deployment_usermanager_address_env_test.yaml index 59bc6ef7dec3595db6149b22a27d3f7f3ba7a842..1498851c20fa62c435aa94276fbd8a86e8a00210 100644 --- a/src/test/helm/deployment_usermanager_address_test.yaml +++ b/src/test/helm/deployment_usermanager_address_env_test.yaml @@ -22,7 +22,7 @@ # unter der Lizenz sind dem Lizenztext zu entnehmen. # -suite: test deployment +suite: test deployment usermanager address env release: name: alfa namespace: sh-helm-test diff --git a/src/test/helm/deployment_defaults_spec_test.yaml b/src/test/helm/deyploment_general_value_and_default_spec_test.yaml similarity index 57% rename from src/test/helm/deployment_defaults_spec_test.yaml rename to src/test/helm/deyploment_general_value_and_default_spec_test.yaml index 96b6b4d8d4c490847740db1b2ac0ce1a5b9f81a8..8ab79d3ef21f1eacf96ace40395ab5435ee54356 100644 --- a/src/test/helm/deployment_defaults_spec_test.yaml +++ b/src/test/helm/deyploment_general_value_and_default_spec_test.yaml @@ -1,5 +1,5 @@ # -# Copyright (C) 2022 Das Land Schleswig-Holstein vertreten durch den +# Copyright (C) 2024 Das Land Schleswig-Holstein vertreten durch den # Ministerpräsidenten des Landes Schleswig-Holstein # Staatskanzlei # Abteilung Digitalisierung und zentrales IT-Management der Landesregierung @@ -22,62 +22,58 @@ # unter der Lizenz sind dem Lizenztext zu entnehmen. # -suite: test deployment +suite: test deployment general values release: name: alfa namespace: sh-helm-test templates: - templates/deployment.yaml -set: +set: baseUrl: test.company.local - replicaCount: 5 ozgcloud: environment: test bundesland: sh bezeichner: helm sso: serverUrl: https://sso.company.local + tests: - - it: should work + - it: should have correct apiVersion asserts: - isKind: of: Deployment + - isAPIVersion: + of: "apps/v1" + + - it: should have correct deployment metadata + asserts: + - equal: + path: metadata.name + value: alfa + - equal: + path: metadata.namespace + value: sh-helm-test + + + - it: should have correct deyployment general spec values + asserts: - equal: path: spec.progressDeadlineSeconds value: 600 - equal: path: spec.replicas - value: 5 + value: 2 - equal: path: spec.revisionHistoryLimit value: 10 - - equal: - path: spec.selector.matchLabels["app.kubernetes.io/name"] - value: alfa - - equal: - path: spec.selector.matchLabels["app.kubernetes.io/namespace"] - value: sh-helm-test - - equal: - path: spec.strategy.rollingUpdate.maxSurge - value: 1 - - equal: - path: spec.strategy.rollingUpdate.maxUnavailable - value: 0 - - equal: - path: spec.strategy.type - value: RollingUpdate - - equal: - path: spec.template.spec.dnsPolicy - value: ClusterFirst - - equal: - path: spec.template.spec.imagePullSecrets[0].name - value: alfa-image-pull-secret - - equal: - path: spec.template.spec.restartPolicy - value: Always - - equal: - path: spec.template.spec.schedulerName - value: default-scheduler - - equal: - path: spec.template.spec.terminationGracePeriodSeconds - value: 30 \ No newline at end of file + - it: should have correct deployment spec strategy values + asserts: + - equal: + path: spec.strategy + value: + rollingUpdate: + maxSurge: 1 + maxUnavailable: 0 + type: RollingUpdate + + diff --git a/src/test/helm/deployment_defaults_annotaion_test.yaml b/src/test/helm/ingress_defaults_annotaion_test.yaml similarity index 96% rename from src/test/helm/deployment_defaults_annotaion_test.yaml rename to src/test/helm/ingress_defaults_annotaion_test.yaml index e8185c86db2a54a1ad820863c7eb8ef98bab3324..069e38601bcb06bff3722c7929a2d06cf8354ce0 100644 --- a/src/test/helm/deployment_defaults_annotaion_test.yaml +++ b/src/test/helm/ingress_defaults_annotaion_test.yaml @@ -41,6 +41,8 @@ tests: asserts: - isKind: of: Ingress + - isAPIVersion: + of: networking.k8s.io/v1 - equal: path: metadata.annotations["cert-manager.io/cluster-issuer"] value: letsencrypt-prod diff --git a/src/test/helm/ingress-nginx-tests.yaml b/src/test/helm/ingress_nginx_tests.yaml similarity index 100% rename from src/test/helm/ingress-nginx-tests.yaml rename to src/test/helm/ingress_nginx_tests.yaml diff --git a/src/test/helm/keycloak-client-crd-test.yaml b/src/test/helm/keycloak_client_crd_test.yaml similarity index 99% rename from src/test/helm/keycloak-client-crd-test.yaml rename to src/test/helm/keycloak_client_crd_test.yaml index dd1a33fce2b69b2b5a8140e8d8a68c141f987a9e..17f2249b721a1eab8b7d279233ef8a5ed41d5d3a 100644 --- a/src/test/helm/keycloak-client-crd-test.yaml +++ b/src/test/helm/keycloak_client_crd_test.yaml @@ -27,7 +27,7 @@ release: name: alfa namespace: by-helm-test templates: - - templates/keycloak-client-crd.yaml + - templates/keycloak_client_crd.yaml set: ozgcloud: bundesland: by diff --git a/src/test/helm/keycloak-crd-test.yaml b/src/test/helm/keycloak_crd_test.yaml similarity index 98% rename from src/test/helm/keycloak-crd-test.yaml rename to src/test/helm/keycloak_crd_test.yaml index 8010a45e07aaae60a865e243de25852f3ab3fd98..7303ec3e192e73c3cacad9e24c7f0174258b38ba 100644 --- a/src/test/helm/keycloak-crd-test.yaml +++ b/src/test/helm/keycloak_crd_test.yaml @@ -27,7 +27,7 @@ release: name: alfa namespace: by-helm-test templates: - - templates/keycloak-crd.yaml + - templates/keycloak_crd.yaml set: ozgcloud: environment: test diff --git a/src/test/helm/keycloak-group-crd-test.yaml b/src/test/helm/keycloak_group_crd_test.yaml similarity index 99% rename from src/test/helm/keycloak-group-crd-test.yaml rename to src/test/helm/keycloak_group_crd_test.yaml index d72c99a0c51205e1330eb29e113aa7cb5d81763b..a86024caed046e290c043db1dbae11022699a906 100644 --- a/src/test/helm/keycloak-group-crd-test.yaml +++ b/src/test/helm/keycloak_group_crd_test.yaml @@ -27,7 +27,7 @@ release: name: alfa namespace: by-helm-test templates: - - templates/keycloak-group-crd.yaml + - templates/keycloak_group_crd.yaml tests: - it: should contain header data set: diff --git a/src/test/helm/keycloak-user-crd-test.yaml b/src/test/helm/keycloak_user_crd_test.yaml similarity index 99% rename from src/test/helm/keycloak-user-crd-test.yaml rename to src/test/helm/keycloak_user_crd_test.yaml index 31dd7d234885048a8ca2bcbd8b93cdec835f6a69..97d1116c82fd20e8cc871cb6e26eb8042718ce76 100644 --- a/src/test/helm/keycloak-user-crd-test.yaml +++ b/src/test/helm/keycloak_user_crd_test.yaml @@ -27,7 +27,7 @@ release: name: alfa namespace: by-helm-test templates: - - templates/keycloak-user-crd.yaml + - templates/keycloak_user_crd.yaml tests: - it: should contain header data set: diff --git a/src/test/helm/network_policy_test.yaml b/src/test/helm/network_policy_test.yaml index 31383e6c2292aca35cae21bd543f7b9a506dfe23..b2c3618952e538706a8992559afee481ebf92589 100644 --- a/src/test/helm/network_policy_test.yaml +++ b/src/test/helm/network_policy_test.yaml @@ -37,6 +37,7 @@ tests: asserts: - isAPIVersion: of: networking.k8s.io/v1 + - it: should match kind asserts: - isKind: diff --git a/src/test/helm/service_monitor_test.yaml b/src/test/helm/service_monitor_test.yaml index d5dd89a4755bc09d9744f62e6554fb8910a7cfec..a22bfee713dff5c6be4674cd431c4bfe5505577c 100644 --- a/src/test/helm/service_monitor_test.yaml +++ b/src/test/helm/service_monitor_test.yaml @@ -29,19 +29,40 @@ release: templates: - templates/service_monitor.yaml tests: - - it: should have the label component with value alfa-service-monitor attached + - it: should have basic info and the label component with value alfa-service-monitor attached asserts: - isKind: of: ServiceMonitor + - isAPIVersion: + of: monitoring.coreos.com/v1 + - equal: + path: metadata.name + value: alfa + - equal: + path: metadata.namespace + value: sh-helm-test - equal: path: metadata.labels["component"] value: alfa-service-monitor + + - it: should contain default lables and component lables + asserts: + - equal: + path: metadata.labels + value: + app.kubernetes.io/instance: alfa + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: alfa + app.kubernetes.io/namespace: sh-helm-test + app.kubernetes.io/part-of: ozgcloud + app.kubernetes.io/version: 0.0.0-MANAGED-BY-JENKINS + component: alfa-service-monitor + helm.sh/chart: alfa-0.0.0-MANAGED-BY-JENKINS + - it: should have the metrics endpoint configured by default set: env.springProfiles: oc,stage asserts: - - isKind: - of: ServiceMonitor - contains: path: spec.endpoints content: @@ -49,8 +70,6 @@ tests: path: /actuator/prometheus - it: should be able to enable the endpoint asserts: - - isKind: - of: ServiceMonitor - contains: path: spec.endpoints content: diff --git a/src/test/helm/service_test.yaml b/src/test/helm/service_test.yaml index 8baec4baff89fec42e21903884a74c9070b548fb..9749ab1b953f4bce475e5f7902257a4e2af743cd 100644 --- a/src/test/helm/service_test.yaml +++ b/src/test/helm/service_test.yaml @@ -29,13 +29,21 @@ release: templates: - templates/service.yaml tests: - - it: should have the label component with value alfa-service attached + - it: should have basics and the label component with value alfa-service attached asserts: - isKind: of: Service + - isAPIVersion: + of: v1 - equal: path: metadata.labels["component"] value: alfa-service + - equal: + path: metadata.name + value: alfa + - equal: + path: metadata.namespace + value: helm-test - it: should be of type ClusterIP asserts: - equal: @@ -75,4 +83,24 @@ tests: - equal: path: spec.selector["app.kubernetes.io/namespace"] value: helm-test - \ No newline at end of file + + - it: selector should contain the component label with the value alfa + asserts: + - equal: + path: spec.selector.component + value: alfa + + - it: should contain default lables and component lables + asserts: + - equal: + path: metadata.labels + value: + app.kubernetes.io/instance: alfa + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: alfa + app.kubernetes.io/namespace: helm-test + app.kubernetes.io/part-of: ozgcloud + app.kubernetes.io/version: 0.0.0-MANAGED-BY-JENKINS + component: alfa-service + helm.sh/chart: alfa-0.0.0-MANAGED-BY-JENKINS + \ No newline at end of file