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 4f85a57
Show file tree
Hide file tree
Showing 17 changed files with 118 additions and 64 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: watcher.openstack.org/v1beta1
kind: Watcher
metadata:
finalizers:
- openstack.org/watcher
name: watcher-kuttl
namespace: watcher-kuttl-default
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: v1
kind: Secret
metadata:
name: watcher-precreated-db-secret
namespace: watcher-kuttl-default
finalizers:
- openstack.org/watcher
---
apiVersion: mariadb.openstack.org/v1beta1
kind: MariaDBAccount
metadata:
name: watcher-precreated
namespace: watcher-kuttl-default
finalizers:
- openstack.org/watcher
- openstack.org/mariadbaccount
labels:
mariaDBDatabaseName: watcher
---
apiVersion: mariadb.openstack.org/v1beta1
kind: MariaDBDatabase
metadata:
name: watcher
namespace: watcher-kuttl-default
finalizers:
- openstack.org/watcher
- openstack.org/mariadbdatabase
- openstack.org/mariadbaccount-watcher-precreated
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.

56 changes: 0 additions & 56 deletions tests/kuttl/test-suites/default/test/04-assert.yaml

This file was deleted.

1 change: 1 addition & 0 deletions tests/kuttl/test-suites/default/test/04-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
delete:
- apiVersion: watcher.openstack.org/v1beta1
kind: WatcherAPI
name: watcherapi-kuttl
26 changes: 26 additions & 0 deletions tests/kuttl/test-suites/default/watcher-api/03-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: watcher.openstack.org/v1beta1
kind: WatcherAPI
metadata:
finalizers:
- openstack.org/watcherapi
name: watcherapi-kuttl
spec:
databaseAccount: watcher
databaseInstance: openstack
passwordSelectors:
service: WatcherPassword
secret: osp-secret
status:
conditions:
- message: Setup complete
reason: Ready
status: "True"
type: Ready
- message: Input data complete
reason: Ready
status: "True"
type: InputReady
- message: Service config create completed
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"
9 changes: 9 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,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 4f85a57

Please sign in to comment.