Skip to content

Commit

Permalink
Add kuttl tests for Keystone service
Browse files Browse the repository at this point in the history
Modifies existing kuttl tests in watcher to cover the watcher keystone service
registration.
  • Loading branch information
amoralej authored and openshift-merge-bot[bot] committed Dec 16, 2024
1 parent 8561592 commit 74f922e
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 5 deletions.
34 changes: 34 additions & 0 deletions tests/kuttl/test-suites/default/watcher/01-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 ]
30 changes: 30 additions & 0 deletions tests/kuttl/test-suites/default/watcher/04-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
6 changes: 1 addition & 5 deletions tests/kuttl/test-suites/default/watcher/05-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,4 @@ namespaced: true
commands:
- script: |
set -ex
oc get mariadbaccount -n watcher-kuttl-default --no-headers=true | [ $(grep -c ^watcher) == 0 ]
oc get mariadbdatabase -n watcher-kuttl-default --no-headers=true | [ $(grep -c ^watcher) == 0 ]
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 exec -n watcher-kuttl-default openstackclient -- openstack service list -f value -c Name -c Type | [ $(grep -c ^watcher) == 0 ]
29 changes: 29 additions & 0 deletions tests/kuttl/test-suites/default/watcher/05-errors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: keystone.openstack.org/v1beta1
kind: KeystoneService
metadata:
name: watcher
---
apiVersion: v1
kind: Secret
metadata:
name: rabbitmq-transport-url-watcher-kuttl-watcher-transport
---
apiVersion: rabbitmq.openstack.org/v1beta1
kind: TransportURL
metadata:
name: watcher-kuttl-watcher-transport
---
apiVersion: mariadb.openstack.org/v1beta1
kind: MariaDBDatabase
metadata:
name: watcher
---
apiVersion: v1
kind: Secret
metadata:
name: watcher-db-secret
---
apiVersion: watcher.openstack.org/v1beta1
kind: Watcher
metadata:
name: watcher-kuttl

0 comments on commit 74f922e

Please sign in to comment.