diff --git a/test/kuttl/common/scripts/check_debug_in_neutron_pod_logs.sh b/test/kuttl/common/scripts/check_debug_in_neutron_pod_logs.sh index 6bc64f83..018c19f0 100755 --- a/test/kuttl/common/scripts/check_debug_in_neutron_pod_logs.sh +++ b/test/kuttl/common/scripts/check_debug_in_neutron_pod_logs.sh @@ -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" diff --git a/test/kuttl/tests/change_neutron_config/00-assert.yaml b/test/kuttl/tests/change_neutron_config/00-assert.yaml new file mode 100644 index 00000000..7bcf5bdf --- /dev/null +++ b/test/kuttl/tests/change_neutron_config/00-assert.yaml @@ -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 diff --git a/test/kuttl/tests/change_neutron_config/00-test-resources.yaml b/test/kuttl/tests/change_neutron_config/00-test-resources.yaml new file mode 100644 index 00000000..ea6b060e --- /dev/null +++ b/test/kuttl/tests/change_neutron_config/00-test-resources.yaml @@ -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 diff --git a/test/kuttl/tests/change_neutron_config/02-assert.yaml b/test/kuttl/tests/change_neutron_config/02-assert.yaml index c676dda3..d88de917 100644 --- a/test/kuttl/tests/change_neutron_config/02-assert.yaml +++ b/test/kuttl/tests/change_neutron_config/02-assert.yaml @@ -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" diff --git a/test/kuttl/tests/change_neutron_config/02-extramounts.yaml b/test/kuttl/tests/change_neutron_config/02-extramounts.yaml new file mode 100644 index 00000000..e676da80 --- /dev/null +++ b/test/kuttl/tests/change_neutron_config/02-extramounts.yaml @@ -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