From 3551dad3e8d17c8007c385c5efdbbadbc6f856af Mon Sep 17 00:00:00 2001 From: Omer Schwartz Date: Tue, 24 Dec 2024 12:42:10 +0000 Subject: [PATCH] Improve Kuttl testing coverage --- .../common/assert-sample-deployment.yaml | 123 ++++++++- tests/kuttl/tests/basic/01-assert.yaml | 177 ++++++++++++- .../basic/ns-records-configmap/02-assert.yaml | 4 +- .../tests/designate_scale/00-assert.yaml | 4 + .../designate_scale/00-test-resources.yaml | 6 + .../tests/designate_scale/01-assert.yaml | 249 ++++++++++++++++++ .../designate_scale/01-deploy-designate.yaml | 5 + .../tests/designate_scale/02-assert.yaml | 27 ++ .../02-scale-designateapi.yaml | 5 + .../tests/designate_scale/03-assert.yaml | 27 ++ .../03-scale-down-designateapi.yaml | 5 + .../tests/designate_scale/04-assert.yaml | 23 ++ .../tests/designate_scale/04-errors.yaml | 7 + .../04-scale-down-zero-designateapi.yaml | 5 + .../designate_scale/05-cleanup-designate.yaml | 6 + .../tests/designate_scale/05-errors.yaml | 56 ++++ 16 files changed, 724 insertions(+), 5 deletions(-) mode change 120000 => 100644 tests/kuttl/tests/basic/01-assert.yaml create mode 100644 tests/kuttl/tests/designate_scale/00-assert.yaml create mode 100644 tests/kuttl/tests/designate_scale/00-test-resources.yaml create mode 100644 tests/kuttl/tests/designate_scale/01-assert.yaml create mode 100644 tests/kuttl/tests/designate_scale/01-deploy-designate.yaml create mode 100644 tests/kuttl/tests/designate_scale/02-assert.yaml create mode 100644 tests/kuttl/tests/designate_scale/02-scale-designateapi.yaml create mode 100644 tests/kuttl/tests/designate_scale/03-assert.yaml create mode 100644 tests/kuttl/tests/designate_scale/03-scale-down-designateapi.yaml create mode 100644 tests/kuttl/tests/designate_scale/04-assert.yaml create mode 100644 tests/kuttl/tests/designate_scale/04-errors.yaml create mode 100644 tests/kuttl/tests/designate_scale/04-scale-down-zero-designateapi.yaml create mode 100644 tests/kuttl/tests/designate_scale/05-cleanup-designate.yaml create mode 100644 tests/kuttl/tests/designate_scale/05-errors.yaml diff --git a/tests/kuttl/common/assert-sample-deployment.yaml b/tests/kuttl/common/assert-sample-deployment.yaml index 18df5dc9..ff983098 100644 --- a/tests/kuttl/common/assert-sample-deployment.yaml +++ b/tests/kuttl/common/assert-sample-deployment.yaml @@ -21,8 +21,88 @@ spec: customServiceConfig: | [DEFAULT] debug = true -# status: -# transportURLSecret: rabbitmq-transport-url-designate-designate-transport +status: + designateAPIReadyCount: 1 + designateBackendbind9ReadyCount: 1 + designateCentralReadyCount: 1 + designateMdnsReadyCount: 1 + designateProducerReadyCount: 1 + designateUnboundReadyCount: 1 + designateWorkerReadyCount: 1 + databaseHostname: openstack.designate-kuttl-tests.svc + conditions: + - message: Setup complete + reason: Ready + status: "True" + type: Ready + - message: DB create completed + reason: Ready + status: "True" + type: DBReady + - message: DBsync completed + reason: Ready + status: "True" + type: DBSyncReady + - message: Setup complete + reason: Ready + status: "True" + type: DesignateAPIReady + - message: Setup complete + reason: Ready + status: "True" + type: DesignateBackendbind9Ready + - message: Setup complete + reason: Ready + status: "True" + type: DesignateCentralReady + - message: Setup complete + reason: Ready + status: "True" + type: DesignateMdnsReady + - message: Setup complete + reason: Ready + status: "True" + type: DesignateProducerReady + - message: DesignateRabbitMqTransportURL successfully created + reason: Ready + status: "True" + type: DesignateRabbitMqTransportURLReady + - message: Setup complete + reason: Ready + status: "True" + type: DesignateUnboundReady + - message: Setup complete + reason: Ready + status: "True" + type: DesignateWorkerReady + - message: Input data complete + reason: Ready + status: "True" + type: InputReady + - message: MariaDBAccount creation complete + reason: Ready + status: "True" + type: MariaDBAccountReady + - message: NetworkAttachments completed + reason: Ready + status: "True" + type: NetworkAttachmentsReady + - message: RoleBinding created + reason: Ready + status: "True" + type: RoleBindingReady + - message: Role created + reason: Ready + status: "True" + type: RoleReady + - message: ServiceAccount created + reason: Ready + status: "True" + type: ServiceAccountReady + - message: Service config create completed + reason: Ready + status: "True" + type: ServiceConfigReady --- apiVersion: v1 kind: Service @@ -64,3 +144,42 @@ commands: exit 1 fi exit 0 + - script: | + tupleTemplate='{{ range (index .spec.template.spec.containers 1).env }}{{ .name }}{{ "#" }}{{ .value}}{{"\n"}}{{ end }}' + imageTuples=$(oc get -n openstack-operators deployment designate-operator-controller-manager -o go-template="$tupleTemplate") + for ITEM in $(echo $imageTuples); do + # it is an image + if echo $ITEM | grep 'RELATED_IMAGE' &> /dev/null; then + NAME=$(echo $ITEM | sed -e 's|^RELATED_IMAGE_DESIGNATE_\([^_]*\)_.*|\1|') + IMG_FROM_ENV=$(echo $ITEM | sed -e 's|^.*#\(.*\)|\1|') + case $NAME in + API) + template='{{.spec.designateAPI.containerImage}}' + ;; + CENTRAL) + template='{{.spec.designateCentral.containerImage}}' + ;; + MDNS) + template='{{.spec.designateMdns.containerImage}}' + ;; + PRODUCER) + template='{{.spec.designateProducer.containerImage}}' + ;; + WORKER) + template='{{.spec.designateWorker.containerImage}}' + ;; + BACKENDBIND9) + template='{{.spec.designateBackendbind9.containerImage}}' + ;; + UNBOUND) + template='{{.spec.designateUnbound.containerImage}}' + ;; + esac + SERVICE_IMAGE=$(oc get -n $NAMESPACE designate designate -o go-template="$template") + if [ "$SERVICE_IMAGE" != "$IMG_FROM_ENV" ]; then + echo "$NAME image does not equal $IMG_FROM_ENV (its current value is $SERVICE_IMAGE)" + exit 1 + fi + fi + done + exit 0 diff --git a/tests/kuttl/tests/basic/01-assert.yaml b/tests/kuttl/tests/basic/01-assert.yaml deleted file mode 120000 index 762a8cf3..00000000 --- a/tests/kuttl/tests/basic/01-assert.yaml +++ /dev/null @@ -1 +0,0 @@ -../../common/assert-sample-deployment.yaml \ No newline at end of file diff --git a/tests/kuttl/tests/basic/01-assert.yaml b/tests/kuttl/tests/basic/01-assert.yaml new file mode 100644 index 00000000..2879aa60 --- /dev/null +++ b/tests/kuttl/tests/basic/01-assert.yaml @@ -0,0 +1,176 @@ +apiVersion: designate.openstack.org/v1beta1 +kind: Designate +metadata: + name: designate +spec: + databaseInstance: openstack + databaseAccount: designate + serviceUser: designate + secret: osp-secret + preserveJobs: false + designateAPI: + replicas: 1 + designateCentral: + replicas: 1 + designateWorker: + replicas: 1 + designateProducer: + replicas: 1 + designateUnbound: + replicas: 1 + customServiceConfig: | + [DEFAULT] + debug = true +status: + designateAPIReadyCount: 1 + designateBackendbind9ReadyCount: 1 + designateCentralReadyCount: 1 + designateMdnsReadyCount: 1 + designateProducerReadyCount: 1 + designateUnboundReadyCount: 1 + designateWorkerReadyCount: 1 + databaseHostname: openstack.designate-kuttl-tests.svc + conditions: + - message: Setup complete + reason: Ready + status: "True" + type: Ready + - message: DB create completed + reason: Ready + status: "True" + type: DBReady + - message: DBsync completed + reason: Ready + status: "True" + type: DBSyncReady + - message: Setup complete + reason: Ready + status: "True" + type: DesignateAPIReady + - message: Setup complete + reason: Ready + status: "True" + type: DesignateBackendbind9Ready + - message: Setup complete + reason: Ready + status: "True" + type: DesignateCentralReady + - message: Setup complete + reason: Ready + status: "True" + type: DesignateMdnsReady + - message: Setup complete + reason: Ready + status: "True" + type: DesignateProducerReady + - message: DesignateRabbitMqTransportURL successfully created + reason: Ready + status: "True" + type: DesignateRabbitMqTransportURLReady + - message: Setup complete + reason: Ready + status: "True" + type: DesignateUnboundReady + - message: Setup complete + reason: Ready + status: "True" + type: DesignateWorkerReady + - message: Input data complete + reason: Ready + status: "True" + type: InputReady + - message: MariaDBAccount creation complete + reason: Ready + status: "True" + type: MariaDBAccountReady + - message: NetworkAttachments completed + reason: Ready + status: "True" + type: NetworkAttachmentsReady + - message: RoleBinding created + reason: Ready + status: "True" + type: RoleBindingReady + - message: Role created + reason: Ready + status: "True" + type: RoleReady + - message: ServiceAccount created + reason: Ready + status: "True" + type: ServiceAccountReady + - message: Service config create completed + reason: Ready + status: "True" + type: ServiceConfigReady +--- +apiVersion: v1 +kind: Service +metadata: + labels: + endpoint: internal + service: designate + name: designate-internal +spec: + ports: + - name: designate-internal + selector: + service: designate + type: ClusterIP +--- +apiVersion: v1 +kind: Service +metadata: + labels: + endpoint: public + service: designate + name: designate-public +spec: + ports: + - name: designate-public + selector: + service: designate + type: ClusterIP +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +commands: + - script: | + tupleTemplate='{{ range (index .spec.template.spec.containers 1).env }}{{ .name }}{{ "#" }}{{ .value}}{{"\n"}}{{ end }}' + imageTuples=$(oc get -n openstack-operators deployment designate-operator-controller-manager -o go-template="$tupleTemplate") + for ITEM in $(echo $imageTuples); do + # it is an image + if echo $ITEM | grep 'RELATED_IMAGE' &> /dev/null; then + NAME=$(echo $ITEM | sed -e 's|^RELATED_IMAGE_DESIGNATE_\([^_]*\)_.*|\1|') + IMG_FROM_ENV=$(echo $ITEM | sed -e 's|^.*#\(.*\)|\1|') + case $NAME in + API) + template='{{.spec.designateAPI.containerImage}}' + ;; + CENTRAL) + template='{{.spec.designateCentral.containerImage}}' + ;; + MDNS) + template='{{.spec.designateMdns.containerImage}}' + ;; + PRODUCER) + template='{{.spec.designateProducer.containerImage}}' + ;; + WORKER) + template='{{.spec.designateWorker.containerImage}}' + ;; + BACKENDBIND9) + template='{{.spec.designateBackendbind9.containerImage}}' + ;; + UNBOUND) + template='{{.spec.designateUnbound.containerImage}}' + ;; + esac + SERVICE_IMAGE=$(oc get -n $NAMESPACE designate designate -o go-template="$template") + if [ "$SERVICE_IMAGE" != "$IMG_FROM_ENV" ]; then + echo "$NAME image does not equal $IMG_FROM_ENV (its current value is $SERVICE_IMAGE)" + exit 1 + fi + fi + done + exit 0 diff --git a/tests/kuttl/tests/basic/ns-records-configmap/02-assert.yaml b/tests/kuttl/tests/basic/ns-records-configmap/02-assert.yaml index 181cb976..7d0b0c48 100644 --- a/tests/kuttl/tests/basic/ns-records-configmap/02-assert.yaml +++ b/tests/kuttl/tests/basic/ns-records-configmap/02-assert.yaml @@ -4,7 +4,7 @@ metadata: name: designate-ns-records-params data: ns_records: | - - host: host1 + - hostname: ns1.example.com priority: 1 - - host: host2 + - hostname: ns2.example.com priority: 2 diff --git a/tests/kuttl/tests/designate_scale/00-assert.yaml b/tests/kuttl/tests/designate_scale/00-assert.yaml new file mode 100644 index 00000000..acc755f7 --- /dev/null +++ b/tests/kuttl/tests/designate_scale/00-assert.yaml @@ -0,0 +1,4 @@ +apiVersion: k8s.cni.cncf.io/v1 +kind: NetworkAttachmentDefinition +metadata: + name: designate diff --git a/tests/kuttl/tests/designate_scale/00-test-resources.yaml b/tests/kuttl/tests/designate_scale/00-test-resources.yaml new file mode 100644 index 00000000..7fc69b55 --- /dev/null +++ b/tests/kuttl/tests/designate_scale/00-test-resources.yaml @@ -0,0 +1,6 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: | + cp ../../common/designate_nad.yaml . + oc apply -n $NAMESPACE -f designate_nad.yaml diff --git a/tests/kuttl/tests/designate_scale/01-assert.yaml b/tests/kuttl/tests/designate_scale/01-assert.yaml new file mode 100644 index 00000000..b58beb10 --- /dev/null +++ b/tests/kuttl/tests/designate_scale/01-assert.yaml @@ -0,0 +1,249 @@ +apiVersion: designate.openstack.org/v1beta1 +kind: Designate +metadata: + name: designate +spec: + databaseInstance: openstack + databaseAccount: designate + serviceUser: designate + secret: osp-secret + preserveJobs: false + designateAPI: + replicas: 1 + designateCentral: + replicas: 1 + designateWorker: + replicas: 1 + designateProducer: + replicas: 1 + designateUnbound: + replicas: 1 + customServiceConfig: | + [DEFAULT] + debug = true +status: + designateAPIReadyCount: 1 + designateBackendbind9ReadyCount: 1 + designateCentralReadyCount: 1 + designateMdnsReadyCount: 1 + designateProducerReadyCount: 1 + designateUnboundReadyCount: 1 + designateWorkerReadyCount: 1 + databaseHostname: openstack.designate-kuttl-tests.svc + conditions: + # - message: Setup complete + # reason: Ready + # status: "True" + # type: Ready + # - message: DB create completed + # reason: Ready + # status: "True" + # type: DBReady + # - message: DBsync completed + # reason: Ready + # status: "True" + # type: DBSyncReady + # - message: Setup complete + # reason: Ready + # status: "True" + # type: InputReady + # - message: MariaDBAccount creation complete + # reason: Ready + # status: "True" + # type: MariaDBAccountReady + # - message: NetworkAttachments completed + # reason: Ready + # status: "True" + # type: NetworkAttachmentsReady + # - message: Setup complete + # reason: Ready + # status: "True" + # type: DesignateAPIReady + # - message: Setup complete + # reason: Ready + # status: "True" + # type: DesignateCentralReady + # - message: Setup complete + # reason: Ready + # status: "True" + # type: DesignateWorkerReady + # - message: Setup complete + # reason: Ready + # status: "True" + # type: DesignateMdnsReady + # - message: Setup complete + # reason: Ready + # status: "True" + # type: DesignateProducerReady + # - message: Setup complete + # reason: Ready + # status: "True" + # type: DesignateBackendbind9Ready + # - message: Setup complete + # reason: Ready + # status: "True" + # type: DesignateUnboundReady + # - message: DesignateRabbitMqTransportURL successfully created + # reason: Ready + # status: "True" + # type: DesignateRabbitMqTransportURLReady + # - message: RoleBinding created + # reason: Ready + # status: "True" + # type: RoleBindingReady + # - message: Role created + # reason: Ready + # status: "True" + # type: RoleReady + # - message: ServiceAccount created + # reason: Ready + # status: "True" + # type: ServiceAccountReady + # - message: Service config create completed + # reason: Ready + # status: "True" + # type: ServiceConfigReady + - message: Setup complete + reason: Ready + status: "True" + type: Ready + - message: DB create completed + reason: Ready + status: "True" + type: DBReady + - message: DBsync completed + reason: Ready + status: "True" + type: DBSyncReady + - message: Setup complete + reason: Ready + status: "True" + type: DesignateAPIReady + - message: Setup complete + reason: Ready + status: "True" + type: DesignateBackendbind9Ready + - message: Setup complete + reason: Ready + status: "True" + type: DesignateCentralReady + - message: Setup complete + reason: Ready + status: "True" + type: DesignateMdnsReady + - message: Setup complete + reason: Ready + status: "True" + type: DesignateProducerReady + - message: DesignateRabbitMqTransportURL successfully created + reason: Ready + status: "True" + type: DesignateRabbitMqTransportURLReady + - message: Setup complete + reason: Ready + status: "True" + type: DesignateUnboundReady + - message: Setup complete + reason: Ready + status: "True" + type: DesignateWorkerReady + - message: Input data complete + reason: Ready + status: "True" + type: InputReady + - message: MariaDBAccount creation complete + reason: Ready + status: "True" + type: MariaDBAccountReady + - message: NetworkAttachments completed + reason: Ready + status: "True" + type: NetworkAttachmentsReady + - message: RoleBinding created + reason: Ready + status: "True" + type: RoleBindingReady + - message: Role created + reason: Ready + status: "True" + type: RoleReady + - message: ServiceAccount created + reason: Ready + status: "True" + type: ServiceAccountReady + - message: Service config create completed + reason: Ready + status: "True" + type: ServiceConfigReady + +--- +apiVersion: v1 +kind: Service +metadata: + labels: + endpoint: internal + service: designate + name: designate-internal +spec: + ports: + - name: designate-internal + selector: + service: designate + type: ClusterIP +--- +apiVersion: v1 +kind: Service +metadata: + labels: + endpoint: public + service: designate + name: designate-public +spec: + ports: + - name: designate-public + selector: + service: designate + type: ClusterIP +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +commands: + - script: | + tupleTemplate='{{ range (index .spec.template.spec.containers 1).env }}{{ .name }}{{ "#" }}{{ .value}}{{"\n"}}{{ end }}' + imageTuples=$(oc get -n openstack-operators deployment designate-operator-controller-manager -o go-template="$tupleTemplate") + for ITEM in $(echo $imageTuples); do + # it is an image + if echo $ITEM | grep 'RELATED_IMAGE' &> /dev/null; then + NAME=$(echo $ITEM | sed -e 's|^RELATED_IMAGE_DESIGNATE_\([^_]*\)_.*|\1|') + IMG_FROM_ENV=$(echo $ITEM | sed -e 's|^.*#\(.*\)|\1|') + case $NAME in + API) + template='{{.spec.designateAPI.containerImage}}' + ;; + CENTRAL) + template='{{.spec.designateCentral.containerImage}}' + ;; + MDNS) + template='{{.spec.designateMdns.containerImage}}' + ;; + PRODUCER) + template='{{.spec.designateProducer.containerImage}}' + ;; + WORKER) + template='{{.spec.designateWorker.containerImage}}' + ;; + BACKENDBIND9) + template='{{.spec.designateBackendbind9.containerImage}}' + ;; + UNBOUND) + template='{{.spec.designateUnbound.containerImage}}' + ;; + esac + SERVICE_IMAGE=$(oc get -n $NAMESPACE designate designate -o go-template="$template") + if [ "$SERVICE_IMAGE" != "$IMG_FROM_ENV" ]; then + echo "$NAME image does not equal $IMG_FROM_ENV (its current value is $SERVICE_IMAGE)" + exit 1 + fi + fi + done + exit 0 diff --git a/tests/kuttl/tests/designate_scale/01-deploy-designate.yaml b/tests/kuttl/tests/designate_scale/01-deploy-designate.yaml new file mode 100644 index 00000000..f706c72b --- /dev/null +++ b/tests/kuttl/tests/designate_scale/01-deploy-designate.yaml @@ -0,0 +1,5 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: | + oc kustomize ../../../../config/samples | oc apply -n $NAMESPACE -f - diff --git a/tests/kuttl/tests/designate_scale/02-assert.yaml b/tests/kuttl/tests/designate_scale/02-assert.yaml new file mode 100644 index 00000000..bd922370 --- /dev/null +++ b/tests/kuttl/tests/designate_scale/02-assert.yaml @@ -0,0 +1,27 @@ +# +# Check for: +# +# - 1 DesignateAPI CR +# - 3 Pods for DesignateAPI CR +# + +apiVersion: designate.openstack.org/v1beta1 +kind: Designate +metadata: + finalizers: + - openstack.org/designate + name: designate +spec: + designateAPI: + replicas: 3 +status: + designateAPIReadyCount: 3 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: designate-api +spec: + replicas: 3 +status: + availableReplicas: 3 diff --git a/tests/kuttl/tests/designate_scale/02-scale-designateapi.yaml b/tests/kuttl/tests/designate_scale/02-scale-designateapi.yaml new file mode 100644 index 00000000..21b87b12 --- /dev/null +++ b/tests/kuttl/tests/designate_scale/02-scale-designateapi.yaml @@ -0,0 +1,5 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: | + oc patch designate -n $NAMESPACE designate --type='json' -p='[{"op": "replace", "path": "/spec/designateAPI/replicas", "value":3}]' diff --git a/tests/kuttl/tests/designate_scale/03-assert.yaml b/tests/kuttl/tests/designate_scale/03-assert.yaml new file mode 100644 index 00000000..53280822 --- /dev/null +++ b/tests/kuttl/tests/designate_scale/03-assert.yaml @@ -0,0 +1,27 @@ +# +# Check for: +# +# - 1 DesignateAPI CR +# - 1 Pods for DesignateAPI CR +# + +apiVersion: designate.openstack.org/v1beta1 +kind: Designate +metadata: + finalizers: + - openstack.org/designate + name: designate +spec: + designateAPI: + replicas: 1 +status: + designateAPIReadyCount: 1 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: designate-api +spec: + replicas: 1 +status: + availableReplicas: 1 diff --git a/tests/kuttl/tests/designate_scale/03-scale-down-designateapi.yaml b/tests/kuttl/tests/designate_scale/03-scale-down-designateapi.yaml new file mode 100644 index 00000000..2ceb251f --- /dev/null +++ b/tests/kuttl/tests/designate_scale/03-scale-down-designateapi.yaml @@ -0,0 +1,5 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: | + oc patch designate -n $NAMESPACE designate --type='json' -p='[{"op": "replace", "path": "/spec/designateAPI/replicas", "value":1}]' diff --git a/tests/kuttl/tests/designate_scale/04-assert.yaml b/tests/kuttl/tests/designate_scale/04-assert.yaml new file mode 100644 index 00000000..08f3ae94 --- /dev/null +++ b/tests/kuttl/tests/designate_scale/04-assert.yaml @@ -0,0 +1,23 @@ +# +# Check for: +# +# - 1 DesignateAPI CR with 0 replicas +# - Designate Deployment with 0 Pods +# + +apiVersion: designate.openstack.org/v1beta1 +kind: Designate +metadata: + finalizers: + - openstack.org/designate + name: designate +spec: + designateAPI: + replicas: 0 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: designate-api +spec: + replicas: 0 diff --git a/tests/kuttl/tests/designate_scale/04-errors.yaml b/tests/kuttl/tests/designate_scale/04-errors.yaml new file mode 100644 index 00000000..2efa4262 --- /dev/null +++ b/tests/kuttl/tests/designate_scale/04-errors.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Pod +metadata: + annotations: + openshift.io/scc: anyuid + labels: + service: designate diff --git a/tests/kuttl/tests/designate_scale/04-scale-down-zero-designateapi.yaml b/tests/kuttl/tests/designate_scale/04-scale-down-zero-designateapi.yaml new file mode 100644 index 00000000..30d97094 --- /dev/null +++ b/tests/kuttl/tests/designate_scale/04-scale-down-zero-designateapi.yaml @@ -0,0 +1,5 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: | + oc patch designate -n $NAMESPACE designate --type='json' -p='[{"op": "replace", "path": "/spec/designateAPI/replicas", "value":0}]' diff --git a/tests/kuttl/tests/designate_scale/05-cleanup-designate.yaml b/tests/kuttl/tests/designate_scale/05-cleanup-designate.yaml new file mode 100644 index 00000000..87839668 --- /dev/null +++ b/tests/kuttl/tests/designate_scale/05-cleanup-designate.yaml @@ -0,0 +1,6 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +delete: +- apiVersion: designate.openstack.org/v1beta1 + kind: Designate + name: designate diff --git a/tests/kuttl/tests/designate_scale/05-errors.yaml b/tests/kuttl/tests/designate_scale/05-errors.yaml new file mode 100644 index 00000000..e965041c --- /dev/null +++ b/tests/kuttl/tests/designate_scale/05-errors.yaml @@ -0,0 +1,56 @@ +# +# Check for: +# +# No DesignateAPI CR +# No Deployment for DesignateAPI CR +# No Pods in designate Deployment +# No Designate Services +# +apiVersion: designate.openstack.org/v1beta1 +kind: Designate +metadata: + finalizers: + - openstack.org/designate + name: designate +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: designate-api +--- +# the openshift annotations can't be checked through the deployment above +apiVersion: v1 +kind: Pod +metadata: + annotations: + openshift.io/scc: anyuid + labels: + service: designate +--- +apiVersion: v1 +kind: Service +metadata: + labels: + endpoint: internal + service: designate + name: designate-internal +spec: + ports: + - name: designate-internal + selector: + service: designate + type: ClusterIP +--- +apiVersion: v1 +kind: Service +metadata: + labels: + endpoint: public + service: designate + name: designate-public +spec: + ports: + - name: designate-public + selector: + service: designate + type: ClusterIP