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

Merge pull request 'OZG-3328 cleanup and add helm tests for operators' (#19)...

Merge pull request 'OZG-3328 cleanup and add helm tests for operators' (#19) from OZG-3328 into master
parents 680c26f7 da8e746a
Branches
Tags
No related merge requests found
Showing
with 462 additions and 97 deletions
...@@ -2,7 +2,3 @@ ...@@ -2,7 +2,3 @@
image: image:
repo: docker.ozg-sh.de repo: docker.ozg-sh.de
elasticsearch:
namespace: elastic-system
adminSecretName: ozg-search-cluster-es-elastic-user
certificateSecretName: ozg-search-cluster-es-http-ca-internal
...@@ -32,6 +32,8 @@ tests: ...@@ -32,6 +32,8 @@ tests:
asserts: asserts:
- isKind: - isKind:
of: ConfigMap of: ConfigMap
- isAPIVersion:
of: v1
- equal: - equal:
path: metadata.name path: metadata.name
value: bindings-type value: bindings-type
......
...@@ -28,13 +28,17 @@ release: ...@@ -28,13 +28,17 @@ release:
namespace: sh-helm-test namespace: sh-helm-test
templates: templates:
- deployment.yaml - deployment.yaml
tests:
- it: validate image type and container image
set: set:
image: image:
name: hase name: hase
tag: latest tag: latest
imagePullSecret: imagePullSecret imagePullSecret: imagePullSecret
elasticsearch:
namespace: elastic-system
adminSecretName: ozg-search-cluster-es-elastic-user
certificateSecretName: ozg-search-cluster-es-http-ca-internal
tests:
- it: validate image type and container image
asserts: asserts:
- equal: - equal:
path: spec.template.spec.containers[0].name path: spec.template.spec.containers[0].name
...@@ -47,11 +51,6 @@ tests: ...@@ -47,11 +51,6 @@ tests:
value: Always value: Always
- it: validate health checks - it: validate health checks
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
asserts: asserts:
- equal: - equal:
path: spec.template.spec.containers[0].readinessProbe path: spec.template.spec.containers[0].readinessProbe
...@@ -78,11 +77,6 @@ tests: ...@@ -78,11 +77,6 @@ tests:
timeoutSeconds: 5 timeoutSeconds: 5
- it: validate security context - it: validate security context
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
asserts: asserts:
- equal: - equal:
path: spec.template.spec.containers[0].securityContext path: spec.template.spec.containers[0].securityContext
......
...@@ -25,9 +25,13 @@ ...@@ -25,9 +25,13 @@
suite: test environments suite: test environments
templates: templates:
- templates/deployment.yaml - templates/deployment.yaml
set:
elasticsearch:
namespace: elastic-system
adminSecretName: ozg-search-cluster-es-elastic-user
certificateSecretName: ozg-search-cluster-es-http-ca-internal
tests: tests:
- it: check customList - it: check customList
template: deployment.yaml
set: set:
env.customList: env.customList:
- name: my_test_environment_name - name: my_test_environment_name
......
...@@ -28,6 +28,11 @@ release: ...@@ -28,6 +28,11 @@ release:
namespace: sh-helm-test namespace: sh-helm-test
templates: templates:
- templates/deployment.yaml - templates/deployment.yaml
set:
elasticsearch:
namespace: elastic-system
adminSecretName: ozg-search-cluster-es-elastic-user
certificateSecretName: ozg-search-cluster-es-http-ca-internal
tests: tests:
- it: check matchlabels - it: check matchlabels
set: set:
......
...@@ -28,42 +28,35 @@ release: ...@@ -28,42 +28,35 @@ release:
namespace: sh-helm-test namespace: sh-helm-test
templates: templates:
- templates/deployment.yaml - templates/deployment.yaml
tests:
- it: check metadata labels
set: set:
image: image:
name: hase name: hase
tag: latest tag: latest
imagePullSecret: imagePullSecret imagePullSecret: imagePullSecret
elasticsearch:
namespace: elastic-system
adminSecretName: ozg-search-cluster-es-elastic-user
certificateSecretName: ozg-search-cluster-es-http-ca-internal
tests:
- it: check metadata labels
asserts: asserts:
- equal: - equal:
path: metadata.labels["app.kubernetes.io/instance"] path: metadata.labels
value: ozgcloud-elasticsearch-operator value:
- equal: app.kubernetes.io/instance: ozgcloud-elasticsearch-operator
path: metadata.labels["app.kubernetes.io/name"] app.kubernetes.io/managed-by: Helm
value: ozgcloud-elasticsearch-operator app.kubernetes.io/name: ozgcloud-elasticsearch-operator
- equal: app.kubernetes.io/namespace: sh-helm-test
path: metadata.labels["app.kubernetes.io/part-of"] app.kubernetes.io/part-of: ozg
value: ozg app.kubernetes.io/version: 0.0.0-MANAGED-BY-JENKINS
- equal: helm.sh/chart: ozgcloud-elasticsearch-operator-0.0.0-MANAGED-BY-JENKINS
path: metadata.labels["app.kubernetes.io/namespace"]
value: sh-helm-test
- it: check metadata name - it: check metadata name
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
asserts: asserts:
- equal: - equal:
path: metadata.name path: metadata.name
value: ozgcloud-elasticsearch-operator value: ozgcloud-elasticsearch-operator
- it: check metadata namespace - it: check metadata namespace
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
asserts: asserts:
- equal: - equal:
path: metadata.namespace path: metadata.namespace
......
...@@ -28,6 +28,11 @@ release: ...@@ -28,6 +28,11 @@ release:
namespace: sh-helm-test namespace: sh-helm-test
templates: templates:
- deployment.yaml - deployment.yaml
set:
elasticsearch:
namespace: elastic-system
adminSecretName: ozg-search-cluster-es-elastic-user
certificateSecretName: ozg-search-cluster-es-http-ca-internal
tests: tests:
- it: validate image pull secret resource name - it: validate image pull secret resource name
set: set:
......
...@@ -27,6 +27,15 @@ release: ...@@ -27,6 +27,15 @@ release:
name: afm-adapter name: afm-adapter
templates: templates:
- templates/deployment.yaml - templates/deployment.yaml
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
elasticsearch:
namespace: elastic-system
adminSecretName: ozg-search-cluster-es-elastic-user
certificateSecretName: ozg-search-cluster-es-http-ca-internal
tests: tests:
- it: test resources - it: test resources
set: set:
...@@ -37,10 +46,6 @@ tests: ...@@ -37,10 +46,6 @@ tests:
requests: requests:
cpu: "33m" cpu: "33m"
memory: "44Mi" memory: "44Mi"
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
asserts: asserts:
- equal: - equal:
path: spec.template.spec.containers[0].resources.limits.cpu path: spec.template.spec.containers[0].resources.limits.cpu
...@@ -56,11 +61,6 @@ tests: ...@@ -56,11 +61,6 @@ tests:
value: 44Mi value: 44Mi
- it: test empty resources - it: test empty resources
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
asserts: asserts:
- isEmpty: - isEmpty:
path: spec.template.spec.containers[0].resources path: spec.template.spec.containers[0].resources
......
...@@ -28,35 +28,29 @@ release: ...@@ -28,35 +28,29 @@ release:
namespace: sh-helm-test namespace: sh-helm-test
templates: templates:
- deployment.yaml - deployment.yaml
tests:
- it: validate serviceaccount name
set: set:
image: image:
name: hase name: hase
tag: latest tag: latest
imagePullSecret: imagePullSecret imagePullSecret: imagePullSecret
elasticsearch:
namespace: elastic-system
adminSecretName: ozg-search-cluster-es-elastic-user
certificateSecretName: ozg-search-cluster-es-http-ca-internal
tests:
- it: validate serviceaccount name
asserts: asserts:
- equal: - equal:
path: spec.template.spec.serviceAccountName path: spec.template.spec.serviceAccountName
value: ozgcloud-elasticsearch-operator-serviceaccount value: ozgcloud-elasticsearch-operator-serviceaccount
- it: validate restartPolicy - it: validate restartPolicy
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
asserts: asserts:
- equal: - equal:
path: spec.template.spec.restartPolicy path: spec.template.spec.restartPolicy
value: Always value: Always
- it: validate dns config - it: validate dns config
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
asserts: asserts:
- equal: - equal:
path: spec.template.spec.dnsConfig path: spec.template.spec.dnsConfig
...@@ -64,3 +58,17 @@ tests: ...@@ -64,3 +58,17 @@ tests:
- equal: - equal:
path: spec.template.spec.dnsPolicy path: spec.template.spec.dnsPolicy
value: ClusterFirst value: ClusterFirst
- 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
...@@ -28,13 +28,17 @@ release: ...@@ -28,13 +28,17 @@ release:
namespace: sh-helm-test namespace: sh-helm-test
templates: templates:
- deployment.yaml - deployment.yaml
tests:
- it: validate template type and api Version
set: set:
image: image:
name: hase name: hase
tag: latest tag: latest
imagePullSecret: imagePullSecret imagePullSecret: imagePullSecret
elasticsearch:
namespace: elastic-system
adminSecretName: ozg-search-cluster-es-elastic-user
certificateSecretName: ozg-search-cluster-es-http-ca-internal
tests:
- it: validate template type and api Version
asserts: asserts:
- isKind: - isKind:
of: Deployment of: Deployment
......
...@@ -22,19 +22,24 @@ ...@@ -22,19 +22,24 @@
# unter der Lizenz sind dem Lizenztext zu entnehmen. # unter der Lizenz sind dem Lizenztext zu entnehmen.
# #
suite: deployment type test suite: deployment volumes test
release: release:
name: elastic-test-operator name: elastic-test-operator
namespace: sh-helm-test namespace: sh-helm-test
templates: templates:
- deployment.yaml - templates/deployment.yaml
tests:
- it: should create SERVICE_BINDING_ROOT
set: set:
image: image:
name: hase name: hase
tag: latest tag: latest
imagePullSecret: imagePullSecret imagePullSecret: imagePullSecret
elasticsearch:
namespace: elastic-system
adminSecretName: ozg-search-cluster-es-elastic-user
certificateSecretName: ozg-search-cluster-es-http-ca-internal
tests:
- it: should create SERVICE_BINDING_ROOT
asserts: asserts:
- contains: - contains:
path: spec.template.spec.containers[0].env path: spec.template.spec.containers[0].env
...@@ -43,11 +48,6 @@ tests: ...@@ -43,11 +48,6 @@ tests:
value: "/bindings" value: "/bindings"
- it: should create volumes - it: should create volumes
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
asserts: asserts:
- contains: - contains:
path: spec.template.spec.volumes path: spec.template.spec.volumes
...@@ -64,11 +64,6 @@ tests: ...@@ -64,11 +64,6 @@ tests:
optional: false optional: false
- it: should create volumeMounts - it: should create volumeMounts
set:
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
asserts: asserts:
- contains: - contains:
path: spec.template.spec.containers[0].volumeMounts path: spec.template.spec.containers[0].volumeMounts
......
...@@ -5,7 +5,7 @@ image: ...@@ -5,7 +5,7 @@ image:
imagePullSecret: "docker-secret" imagePullSecret: "docker-secret"
env: elasticsearch:
customList: namespace: elastic-system
- name: my_test_environment_name adminSecretName: ozg-search-cluster-es-elastic-user
value: "A test value" certificateSecretName: ozg-search-cluster-es-http-ca-internal
\ No newline at end of file \ No newline at end of file
...@@ -28,6 +28,11 @@ release: ...@@ -28,6 +28,11 @@ release:
namespace: test-namespace namespace: test-namespace
templates: templates:
- templates/rbac/ozgcloud_elasticsearch_operator_admin_secret_view_role.yaml - templates/rbac/ozgcloud_elasticsearch_operator_admin_secret_view_role.yaml
set:
elasticsearch:
namespace: elastic-system
adminSecretName: ozg-search-cluster-es-elastic-user
certificateSecretName: ozg-search-cluster-es-http-ca-internal
tests: tests:
- it: should have apiVersion - it: should have apiVersion
asserts: asserts:
......
...@@ -28,6 +28,11 @@ release: ...@@ -28,6 +28,11 @@ release:
namespace: sh-helm-test namespace: sh-helm-test
templates: templates:
- templates/rbac/ozgcloud_elasticsearch_operator_admin_secret_view_rolebinding.yaml - templates/rbac/ozgcloud_elasticsearch_operator_admin_secret_view_rolebinding.yaml
set:
elasticsearch:
namespace: elastic-system
adminSecretName: ozg-search-cluster-es-elastic-user
certificateSecretName: ozg-search-cluster-es-http-ca-internal
tests: tests:
- it: should have apiVersion - it: should have apiVersion
asserts: asserts:
......
...@@ -33,6 +33,8 @@ tests: ...@@ -33,6 +33,8 @@ tests:
asserts: asserts:
- isKind: - isKind:
of: ServiceAccount of: ServiceAccount
- isAPIVersion:
of: v1
- equal: - equal:
path: metadata.name path: metadata.name
value: ozgcloud-elasticsearch-operator-serviceaccount value: ozgcloud-elasticsearch-operator-serviceaccount
......
suite: operator.ozgcloud.de_OzgCloudKeycloakClient test
templates:
- templates/crds/operator.ozgcloud.de_OzgKeycloakClient.yaml
tests:
- it: should have apiVersion
asserts:
- equal:
path: apiVersion
value: apiextensions.k8s.io/v1
- it: should have isKind of
asserts:
- isKind:
of: CustomResourceDefinition
- it: should have metadata name
asserts:
- equal:
path: metadata.name
value: ozgcloudkeycloakclients.operator.ozgcloud.de
- it: should have spec group
asserts:
- equal:
path: spec.group
value: operator.ozgcloud.de
- it: should have spec names kind
asserts:
- equal:
path: spec.names.kind
value: OzgCloudKeycloakClient
- it: should have spec names listKind
asserts:
- equal:
path: spec.names.listKind
value: OzgCloudKeycloakClientList
- it: should have spec names plural
asserts:
- equal:
path: spec.names.plural
value: ozgcloudkeycloakclients
- it: should have spec names singular
asserts:
- equal:
path: spec.names.singular
value: ozgcloudkeycloakclient
- it: should have spec scope
asserts:
- equal:
path: spec.scope
value: Namespaced
\ No newline at end of file
suite: operator.ozgcloud.de_OzgCloudKeycloakClient versions v1 test
templates:
- templates/crds/operator.ozgcloud.de_OzgKeycloakClient.yaml
tests:
- it: should have versions name
asserts:
- equal:
path: spec.versions[0].name
value: v1
- it: should have versions schema description
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.description
value: OzgCloudKeycloakClient is the Schema for the keycloaks API
- it: should have versions schema type
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.type
value: object
- it: should have versions schema apiVersion property type
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.apiVersion.type
value: string
- it: should have versions schema apiVersion property description
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.apiVersion.description
value: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
- it: should have versions schema kind property type
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.kind.type
value: string
- it: should have versions schema kind property description
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.kind.description
value: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
- it: should have versions schema metadata
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.metadata.type
value: object
- it: should have versions schema spec description
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.spec.description
value: Spec defines the desired state of Keycloak
- it: should have versions schema spec type
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.spec.type
value: object
- it: should have versions schema spec preserve unknown fields
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.spec.x-kubernetes-preserve-unknown-fields
value: true
- it: should have versions schema status description
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.status.description
value: Status defines the observed state of Keycloak
- it: should have versions schema status type
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.status.type
value: object
- it: should have versions schema status preserve unknown fields
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.status.x-kubernetes-preserve-unknown-fields
value: true
- it: should have versions served
asserts:
- equal:
path: spec.versions[0].served
value: true
- it: should have versions storage
asserts:
- equal:
path: spec.versions[0].storage
value: true
- it: should have versions subresources statis
asserts:
- equal:
path: spec.versions[0].subresources.status
value: {}
\ No newline at end of file
suite: operator.ozgcloud.de_OzgCloudKeycloakGroup test
templates:
- templates/crds/operator.ozgcloud.de_OzgKeycloakGroup.yaml
tests:
- it: should have apiVersion
asserts:
- equal:
path: apiVersion
value: apiextensions.k8s.io/v1
- it: should have isKind of
asserts:
- isKind:
of: CustomResourceDefinition
- it: should have metadata name
asserts:
- equal:
path: metadata.name
value: ozgcloudkeycloakgroups.operator.ozgcloud.de
- it: should have spec group
asserts:
- equal:
path: spec.group
value: operator.ozgcloud.de
- it: should have spec names kind
asserts:
- equal:
path: spec.names.kind
value: OzgCloudKeycloakGroup
- it: should have spec names listKind
asserts:
- equal:
path: spec.names.listKind
value: OzgCloudKeycloakGroupList
- it: should have spec names plural
asserts:
- equal:
path: spec.names.plural
value: ozgcloudkeycloakgroups
- it: should have spec names singular
asserts:
- equal:
path: spec.names.singular
value: ozgcloudkeycloakgroup
- it: should have spec scope
asserts:
- equal:
path: spec.scope
value: Namespaced
\ No newline at end of file
suite: operator.ozgcloud.de_OzgCloudKeycloakGroup versions v1 test
templates:
- templates/crds/operator.ozgcloud.de_OzgKeycloakGroup.yaml
tests:
- it: should have versions name
asserts:
- equal:
path: spec.versions[0].name
value: v1
- it: should have versions schema description
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.description
value: OzgCloudKeycloakGroup is the Schema for the keycloaks API
- it: should have versions schema type
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.type
value: object
- it: should have versions schema apiVersion property type
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.apiVersion.type
value: string
- it: should have versions schema apiVersion property description
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.apiVersion.description
value: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
- it: should have versions schema kind property type
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.kind.type
value: string
- it: should have versions schema kind property description
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.kind.description
value: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
- it: should have versions schema metadata
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.metadata.type
value: object
- it: should have versions schema spec description
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.spec.description
value: Spec defines the desired state of Keycloak
- it: should have versions schema spec type
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.spec.type
value: object
- it: should have versions schema spec preserve unknown fields
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.spec.x-kubernetes-preserve-unknown-fields
value: true
- it: should have versions schema status description
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.status.description
value: Status defines the observed state of Keycloak
- it: should have versions schema status type
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.status.type
value: object
- it: should have versions schema status preserve unknown fields
asserts:
- equal:
path: spec.versions[0].schema.openAPIV3Schema.properties.status.x-kubernetes-preserve-unknown-fields
value: true
- it: should have versions served
asserts:
- equal:
path: spec.versions[0].served
value: true
- it: should have versions storage
asserts:
- equal:
path: spec.versions[0].storage
value: true
- it: should have versions subresources statis
asserts:
- equal:
path: spec.versions[0].subresources.status
value: {}
\ No newline at end of file
suite: operator.ozgcloud.de_OzgCloudKeycloakRealms test
templates:
- templates/crds/operator.ozgcloud.de_OzgKeycloakRealms.yaml
tests:
- it: should have apiVersion
asserts:
- equal:
path: apiVersion
value: apiextensions.k8s.io/v1
- it: should have isKind of
asserts:
- isKind:
of: CustomResourceDefinition
- it: should have metadata name
asserts:
- equal:
path: metadata.name
value: ozgcloudkeycloakrealms.operator.ozgcloud.de
- it: should have spec group
asserts:
- equal:
path: spec.group
value: operator.ozgcloud.de
- it: should have spec names kind
asserts:
- equal:
path: spec.names.kind
value: OzgCloudKeycloakRealm
- it: should have spec names listKind
asserts:
- equal:
path: spec.names.listKind
value: OzgCloudKeycloakRealmList
- it: should have spec names plural
asserts:
- equal:
path: spec.names.plural
value: ozgcloudkeycloakrealms
- it: should have spec names singular
asserts:
- equal:
path: spec.names.singular
value: ozgcloudkeycloakrealm
- it: should have spec scope
asserts:
- equal:
path: spec.scope
value: Namespaced
\ 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