Skip to content

Commit

Permalink
Add kuttl tests for WatcherAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
cescgina committed Nov 28, 2024
1 parent fbdee2a commit 254a88a
Show file tree
Hide file tree
Showing 13 changed files with 158 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ delete:
- apiVersion: watcher.openstack.org/v1beta1
kind: Watcher
name: watcher-kuttl
namespace: watcher-kuttl-default
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: watcher.openstack.org/v1beta1
kind: Watcher
metadata:
name: watcher-kuttl
namespace: watcher-kuttl-default
spec:
databaseInstance: "openstack"

This file was deleted.

20 changes: 20 additions & 0 deletions tests/kuttl/test-suites/default/watcher-api/02-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: watcher.openstack.org/v1beta1
kind: WatcherAPI
metadata:
finalizers:
- openstack.org/watcherapi
name: watcherapi-kuttl
status:
conditions:
- message: Setup complete
reason: Ready
status: "True"
type: Ready
- message: Input data completed
reason: Ready
status: "True"
type: InputReady
- message: Service config create complete
reason: Ready
status: "True"
type: ServiceConfigReady
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: watcher.openstack.org/v1beta1
kind: WatcherAPI
metadata:
name: watcherapi-kuttl
spec:
databaseInstance: "openstack"
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
delete:
- apiVersion: watcher.openstack.org/v1beta1
kind: Watcher
name: watcher-kuttl
- apiVersion: watcherapi.openstack.org/v1beta1
kind: WatcherAPI
name: watcherapi-kuttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: mariadb.openstack.org/v1beta1
kind: MariaDBAccount
metadata:
name: watcher-precreated
namespace: watcher-kuttl-default
spec:
requireTLS: false
secret: watcher-db-secret
userName: watcher_test
79 changes: 79 additions & 0 deletions tests/kuttl/test-suites/default/watcher-api/05-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
apiVersion: watcher.openstack.org/v1beta1
kind: Watcher
metadata:
finalizers:
- openstack.org/watcher
name: watcher-kuttl
spec:
databaseAccount: watcher-precreated
databaseInstance: openstack
passwordSelectors:
service: WatcherPassword
secret: osp-secret
status:
conditions:
- message: Setup complete
reason: Ready
status: "True"
type: Ready
- message: DB create completed
reason: Ready
status: "True"
type: DBReady
- message: MariaDBAccount creation complete
reason: Ready
status: "True"
type: MariaDBAccountReady
---
apiVersion: watcherapi.openstack.org/v1beta1
kind: WatcherAPI
spec:
databaseAccount: watcher-precreated
databaseInstance: openstack
passwordSelectors:
service: WatcherPassword
secret: osp-secret
metadata:
finalizers:
- openstack.org/watcherapi
name: watcherapi-kuttl
status:
conditions:
- message: Setup complete
reason: Ready
status: "True"
type: Ready
- message: Input data completed
reason: Ready
status: "True"
type: InputReady
- message: Service config create complete
reason: Ready
status: "True"
type: ServiceConfigReady
---
apiVersion: v1
kind: Secret
metadata:
name: watcher-db-secret
finalizers:
- openstack.org/watcher
---
apiVersion: mariadb.openstack.org/v1beta1
kind: MariaDBAccount
metadata:
name: watcher-precreated
finalizers:
- openstack.org/watcher
- openstack.org/mariadbaccount
labels:
mariaDBDatabaseName: watcher
---
apiVersion: mariadb.openstack.org/v1beta1
kind: MariaDBDatabase
metadata:
name: watcher
finalizers:
- openstack.org/watcher
- openstack.org/mariadbdatabase
- openstack.org/mariadbaccount-watcher-precreated
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: watcher.openstack.org/v1beta1
kind: Watcher
metadata:
name: watcher-kuttl
spec:
databaseInstance: "openstack"
databaseAccount: watcher-precreated
---
apiVersion: watcherapi.openstack.org/v1beta1
kind: WatcherAPI
metadata:
name: watcherapi-kuttl
spec:
databaseInstance: "openstack"
databaseAccount: watcher-precreated
9 changes: 9 additions & 0 deletions tests/kuttl/test-suites/default/watcher-api/06-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
namespaced: true
commands:
- script: |
set -ex
oc get mariadbaccount -n ${NAMESPACE} --no-headers=true | [ $(grep -c ^watcher) == 0 ]
oc get mariadbdatabase -n ${NAMESPACE} --no-headers=true | [ $(grep -c ^watcher) == 0 ]
oc get secret -n ${NAMESPACE} --no-headers=true | [ $(grep -c ^watcher) == 0 ]

0 comments on commit 254a88a

Please sign in to comment.