Skip to content

Commit

Permalink
Merge pull request #406 from karelyatin/OSPRH-4296
Browse files Browse the repository at this point in the history
Add kuttl tests to validate config overrides with extraMounts
  • Loading branch information
openshift-merge-bot[bot] authored Sep 10, 2024
2 parents 6840c60 + 9fcb695 commit 43c86b7
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

pod=$(oc get pods -n $NAMESPACE -l service=neutron -o name)
pod=$(oc get pods -n $NAMESPACE -l service=neutron --field-selector=status.phase=Running -o name|head -1)

# Check if the neutron pod logs contain DEBUG messages
oc logs -n $NAMESPACE "$pod" | grep -q "DEBUG"
Expand Down
15 changes: 15 additions & 0 deletions test/kuttl/tests/change_neutron_config/00-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#
# Check for:
#
# - Secret
# - ConfigMap

apiVersion: v1
kind: Secret
metadata:
name: test-secret-vol
---
apiVersion: v1
kind: ConfigMap
metadata:
name: test-configmap-vol
19 changes: 19 additions & 0 deletions test/kuttl/tests/change_neutron_config/00-test-resources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# test-secret-vol Secret
# test-configmap-vol ConfiMap
#
apiVersion: v1
kind: Secret
metadata:
name: test-secret-vol
data:
testsecret.conf: W0RFRkFVTFRdCnJwY193b3JrZXJzID0gMAo=
---
apiVersion: v1
kind: ConfigMap
metadata:
name: test-configmap-vol
data:
testcm.conf: |
[DEFAULT]
api_workers = 1
7 changes: 7 additions & 0 deletions test/kuttl/tests/change_neutron_config/02-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@ kind: TestAssert
commands:
- script: |
$NEUTRON_KUTTL_DIR/../common/scripts/check_debug_in_neutron_pod_logs.sh
- script: |
neutron_pod=$(oc get pods -n $NAMESPACE -l service=neutron --field-selector=status.phase=Running -o name|head -1)
oc rsh -n $NAMESPACE ${neutron_pod} crudini --get /etc/neutron/neutron.conf.d/testcm.conf DEFAULT api_workers
oc rsh -n $NAMESPACE ${neutron_pod} crudini --get /etc/neutron/neutron.conf.d/testsecret.conf DEFAULT rpc_workers
# Check config in pod logs
oc logs -n $NAMESPACE ${neutron_pod} | grep -q "api_workers.*= 1"
oc logs -n $NAMESPACE ${neutron_pod} | grep -q "rpc_workers.*= 0"
23 changes: 23 additions & 0 deletions test/kuttl/tests/change_neutron_config/02-extramounts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: neutron.openstack.org/v1beta1
kind: NeutronAPI
metadata:
name: neutron
spec:
extraMounts:
- extraVol:
- volumes:
- name: test-configmap-vol
configMap:
name: test-configmap-vol
- name: test-secret-vol
secret:
secretName: test-secret-vol
mounts:
- name: test-configmap-vol
mountPath: /etc/neutron/neutron.conf.d/testcm.conf
subPath: testcm.conf
readOnly: true
- name: test-secret-vol
mountPath: /etc/neutron/neutron.conf.d/testsecret.conf
subPath: testsecret.conf
readOnly: false

0 comments on commit 43c86b7

Please sign in to comment.