Skip to content
Snippets Groups Projects
Commit 8f217095 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-3328 cleanup helm unittests and add tests to cover each line

parent ba669ab6
Branches
Tags
No related merge requests found
......@@ -22,13 +22,23 @@
suite: configmap_bindings_type
release:
name: administration
namespace: sh-helm-test
templates:
- templates/configmap_bindings_type.yaml
set:
Release.Namespace: "administration"
tests:
- it: validate configmap values
asserts:
- isKind:
of: ConfigMap
- isAPIVersion:
of: v1
- equal:
path: metadata.name
value: administration-bindings-type
- equal:
path: metadata.namespace
value: sh-helm-test
- equal:
path: data.type
value: "ca-certificates"
\ No newline at end of file
#
# 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 default labels
release:
name: administration
namespace: sh-helm-test
templates:
- templates/deployment.yaml
set:
ozgcloud:
bundesland: sh
bezeichner: helm
sso:
serverUrl: https://sso.company.local
tests:
- it: check metadata.labels
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: administration
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: administration
app.kubernetes.io/namespace: sh-helm-test
helm.sh/chart: administration-0.0.0-MANAGED-BY-JENKINS
- it: should set spec.selector.matchLabels
asserts:
- equal:
path: spec.selector.matchLabels
value:
app.kubernetes.io/name: administration
app.kubernetes.io/namespace: sh-helm-test
- it: should have correct deyploment spec.template.metadata.labels
asserts:
- equal:
path: spec.template.metadata.labels
value:
app.kubernetes.io/instance: administration
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: administration
app.kubernetes.io/namespace: sh-helm-test
component: administration
helm.sh/chart: administration-0.0.0-MANAGED-BY-JENKINS
\ No newline at end of file
......@@ -22,7 +22,7 @@
# unter der Lizenz sind dem Lizenztext zu entnehmen.
#
suite: test deployment
suite: test deployment sso
release:
name: administration
namespace: sh-helm-test
......@@ -57,29 +57,12 @@ tests:
name: ozgcloud_oauth2_auth-server-url
value: https://sso.company.local
- it: check realm with long namespace
set:
ozgcloud:
bezeichner: eins-zwei-drei
environment: dev
bundesland: sh
asserts:
- isKind:
of: Deployment
- contains:
path: spec.template.spec.containers[0].env
content:
name: ozgcloud_oauth2_realm
value: sh-eins-zwei-drei-dev
- it: check different client name
set:
sso:
keycloak_client:
client_name: different-client
asserts:
- isKind:
of: Deployment
- contains:
path: spec.template.spec.containers[0].env
content:
......
......@@ -41,3 +41,7 @@ tests:
- equal:
path: spec.template.spec.containers[0].resources
value: { "test": 1 }
- it: should not generate resources when values not set
asserts:
- isEmpty:
path: spec.template.spec.containers[0].resources
\ No newline at end of file
......@@ -39,8 +39,6 @@ tests:
set:
env.overrideSpringProfiles: oc,dev,ea
asserts:
- isKind:
of: Deployment
- contains:
path: spec.template.spec.containers[0].env
content:
......@@ -48,8 +46,6 @@ tests:
value: oc,dev,ea
- it: should generate the spring profiles
asserts:
- isKind:
of: Deployment
- contains:
path: spec.template.spec.containers[0].env
content:
......
......@@ -39,6 +39,8 @@ tests:
asserts:
- isKind:
of: Deployment
- isAPIVersion:
of: apps/v1
- equal:
path: metadata.name
value: "administration"
......@@ -77,12 +79,6 @@ tests:
value: "RollingUpdate"
- it: should have correct template configuration
asserts:
- equal:
path: spec.template.metadata.labels["app.kubernetes.io/instance"]
value: "administration"
- equal:
path: spec.template.metadata.labels.component
value: "administration"
- equal:
path: spec.template.spec.topologySpreadConstraints[0].maxSkew
value: 1
......
......@@ -126,4 +126,4 @@ tests:
dnsServerNamespace: test-dns-server-namespace
asserts:
- hasDocuments:
count: 1
count: 1
\ No newline at end of file
......@@ -37,14 +37,6 @@ tests:
apiVersion: v1
name: administration
namespace: helm-test
- it: should have valid metadata values
asserts:
- equal:
path: metadata.labels["helm.sh/chart"]
value: administration-0.0.0-helm-test-version
- equal:
path: metadata.labels.component
value: administration-service
- it: should be of type ClusterIP
asserts:
- equal:
......@@ -79,4 +71,15 @@ tests:
asserts:
- equal:
path: spec.selector.component
value: administration
\ No newline at end of file
value: administration
- it: should contain default lables and component lables
asserts:
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: administration
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: administration
app.kubernetes.io/namespace: helm-test
component: administration-service
helm.sh/chart: administration-0.0.0-helm-test-version
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment