From 8c46203732c97e8a3bc4bfc96dc55d0b416b0482 Mon Sep 17 00:00:00 2001 From: Alfredo Moralejo Date: Fri, 13 Dec 2024 08:58:21 +0100 Subject: [PATCH] Add kuttl tests for Keystone service Modifies existing kuttl tests in watcher to cover the watcher keystone service registration. --- .../default/watcher/01-assert.yaml | 34 +++++++++++++++++++ .../default/watcher/04-assert.yaml | 30 ++++++++++++++++ .../default/watcher/05-assert.yaml | 2 ++ 3 files changed, 66 insertions(+) diff --git a/tests/kuttl/test-suites/default/watcher/01-assert.yaml b/tests/kuttl/test-suites/default/watcher/01-assert.yaml index 915cd76..8c67fc8 100644 --- a/tests/kuttl/test-suites/default/watcher/01-assert.yaml +++ b/tests/kuttl/test-suites/default/watcher/01-assert.yaml @@ -15,6 +15,14 @@ status: reason: Ready status: "True" type: DBReady + - message: Input data complete + reason: Ready + status: "True" + type: InputReady + - message: Setup complete + reason: Ready + status: "True" + type: KeystoneServiceReady - message: MariaDBAccount creation complete reason: Ready status: "True" @@ -80,3 +88,29 @@ kind: Secret metadata: name: rabbitmq-transport-url-watcher-kuttl-watcher-transport namespace: watcher-kuttl-default +--- +apiVersion: keystone.openstack.org/v1beta1 +kind: KeystoneService +metadata: + name: watcher + finalizers: + - openstack.org/watcher + - openstack.org/keystoneservice +spec: + enabled: true + passwordSelector: WatcherPassword + secret: osp-secret + serviceDescription: Watcher Service + serviceName: watcher + serviceType: infra-optim + serviceUser: watcher +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +namespaced: true +commands: + - script: | + set -euxo pipefail + oc exec -n watcher-kuttl-default openstackclient -- openstack service list -f value -c Name -c Type |[ $(grep -c ^watcher) == 1 ] + SERVICEID=$(oc exec -n watcher-kuttl-default openstackclient -- openstack service list -f value -c Name -c Type -c ID | grep watcher| awk '{print $1}') + [ $(oc get -n watcher-kuttl-default keystoneservice watcher -o jsonpath={.status.serviceID}) == $SERVICEID ] diff --git a/tests/kuttl/test-suites/default/watcher/04-assert.yaml b/tests/kuttl/test-suites/default/watcher/04-assert.yaml index 04a7e37..5973a7e 100644 --- a/tests/kuttl/test-suites/default/watcher/04-assert.yaml +++ b/tests/kuttl/test-suites/default/watcher/04-assert.yaml @@ -21,6 +21,14 @@ status: reason: Ready status: "True" type: DBReady + - message: Input data complete + reason: Ready + status: "True" + type: InputReady + - message: Setup complete + reason: Ready + status: "True" + type: KeystoneServiceReady - message: MariaDBAccount creation complete reason: Ready status: "True" @@ -86,3 +94,25 @@ kind: Secret metadata: name: rabbitmq-transport-url-watcher-kuttl-watcher-transport namespace: watcher-kuttl-default +--- +apiVersion: v1 +kind: Secret +metadata: + name: rabbitmq-transport-url-watcher-kuttl-watcher-transport + namespace: watcher-kuttl-default +--- +apiVersion: keystone.openstack.org/v1beta1 +kind: KeystoneService +metadata: + name: watcher + finalizers: + - openstack.org/watcher + - openstack.org/keystoneservice +spec: + enabled: true + passwordSelector: WatcherPassword + secret: osp-secret + serviceDescription: Watcher Service + serviceName: watcher + serviceType: infra-optim + serviceUser: watcher diff --git a/tests/kuttl/test-suites/default/watcher/05-assert.yaml b/tests/kuttl/test-suites/default/watcher/05-assert.yaml index c7b26f7..dd04ac5 100644 --- a/tests/kuttl/test-suites/default/watcher/05-assert.yaml +++ b/tests/kuttl/test-suites/default/watcher/05-assert.yaml @@ -9,3 +9,5 @@ commands: oc get secret -n watcher-kuttl-default --no-headers=true | [ $(grep -c ^watcher) == 0 ] oc get secret -n watcher-kuttl-default --no-headers=true | [ $(grep -c ^rabbitmq-transport-url-.*-watcher-transport) == 0 ] oc get transporturl -n watcher-kuttl-default --no-headers=true | [ $(grep -c ^watcher-kuttl-watcher-transport) == 0 ] + oc get keystoneservice -n watcher-kuttl-default --no-headers=true | [ $(grep -c ^watcher) == 0 ] + oc exec -n watcher-kuttl-default openstackclient -- openstack service list -f value -c Name -c Type | [ $(grep -c ^watcher) == 0 ]