Skip to content

Commit ad8a5cc

Browse files
committed
Add kuttl tests for customServiceConfig
This patch adds some validation in kuttl tests to test customServiceConfig
1 parent 1b2cae6 commit ad8a5cc

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

tests/kuttl/test-suites/default/watcher/04-assert.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ spec:
1010
databaseInstance: openstack
1111
passwordSelectors:
1212
service: WatcherPassword
13+
customServiceConfig: |
14+
# Global config
1315
secret: osp-secret
1416
apiServiceTemplate:
1517
replicas: 2
1618
resources: {}
19+
customServiceConfig: |
20+
# Service config
1721
status:
1822
apiServiceReadyCount: 2
1923
conditions:
@@ -227,3 +231,18 @@ spec:
227231
status:
228232
readyReplicas: 2
229233
replicas: 2
234+
---
235+
apiVersion: kuttl.dev/v1beta1
236+
kind: TestAssert
237+
namespaced: true
238+
commands:
239+
- script: |
240+
set -euxo pipefail
241+
oc project watcher-kuttl-default
242+
APIPOD=$(oc get pods -n watcher-kuttl-default -l "service=watcher-api" -ocustom-columns=:metadata.name|grep -v ^$|head -1)
243+
if [ -n "${APIPOD}" ]; then
244+
[ $(echo $(oc rsh -c watcher-api ${APIPOD} cat /etc/watcher/watcher.conf.d/01-global-custom.conf) |grep -c "^# Global config") == 1 ]
245+
[ $(echo $(oc rsh -c watcher-api ${APIPOD} cat /etc/watcher/watcher.conf.d/02-service-custom.conf) |grep -c "^# Service config") == 1 ]
246+
else
247+
exit 1
248+
fi

tests/kuttl/test-suites/default/watcher/04-deploy-with-precreated-account.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ metadata:
66
spec:
77
databaseInstance: "openstack"
88
databaseAccount: watcher-precreated
9-
apiServiceTemplate:
10-
replicas: 2
119
tls:
1210
caBundleSecretName: "combined-ca-bundle"
11+
customServiceConfig: |
12+
# Global config
13+
apiServiceTemplate:
14+
replicas: 2
15+
customServiceConfig: |
16+
# Service config

0 commit comments

Comments
 (0)