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 new file mode 100755 index 00000000..6bc64f83 --- /dev/null +++ b/test/kuttl/common/scripts/check_debug_in_neutron_pod_logs.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +pod=$(oc get pods -n $NAMESPACE -l service=neutron -o name) + +# Check if the neutron pod logs contain DEBUG messages +oc logs -n $NAMESPACE "$pod" | grep -q "DEBUG" +exit $? diff --git a/test/kuttl/tests/change_neutron_config/01-assert.yaml b/test/kuttl/tests/change_neutron_config/01-assert.yaml new file mode 120000 index 00000000..461654ea --- /dev/null +++ b/test/kuttl/tests/change_neutron_config/01-assert.yaml @@ -0,0 +1 @@ +../../common/assert_sample_deployment.yaml \ No newline at end of file diff --git a/test/kuttl/tests/change_neutron_config/01-deploy-neutron.yaml b/test/kuttl/tests/change_neutron_config/01-deploy-neutron.yaml new file mode 100644 index 00000000..af916ae6 --- /dev/null +++ b/test/kuttl/tests/change_neutron_config/01-deploy-neutron.yaml @@ -0,0 +1,6 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: | + cp ../../../../config/samples/neutron_v1beta1_neutronapi.yaml deploy + oc kustomize deploy | oc apply -n $NAMESPACE -f - diff --git a/test/kuttl/tests/change_neutron_config/02-assert.yaml b/test/kuttl/tests/change_neutron_config/02-assert.yaml new file mode 100644 index 00000000..c676dda3 --- /dev/null +++ b/test/kuttl/tests/change_neutron_config/02-assert.yaml @@ -0,0 +1,6 @@ +# check that by default, debug is set in neutron config +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +commands: + - script: | + $NEUTRON_KUTTL_DIR/../common/scripts/check_debug_in_neutron_pod_logs.sh diff --git a/test/kuttl/tests/change_neutron_config/03-assert.yaml b/test/kuttl/tests/change_neutron_config/03-assert.yaml new file mode 100644 index 00000000..f6d17f93 --- /dev/null +++ b/test/kuttl/tests/change_neutron_config/03-assert.yaml @@ -0,0 +1,7 @@ +# check that now, debug is not set in neutron config +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +commands: + - script: | + $NEUTRON_KUTTL_DIR/../common/scripts/check_debug_in_neutron_pod_logs.sh + test $? -ne 0 diff --git a/test/kuttl/tests/change_neutron_config/03-change_neutron_debug_config.yaml b/test/kuttl/tests/change_neutron_config/03-change_neutron_debug_config.yaml new file mode 100644 index 00000000..9ecc8d6d --- /dev/null +++ b/test/kuttl/tests/change_neutron_config/03-change_neutron_debug_config.yaml @@ -0,0 +1,8 @@ +apiVersion: neutron.openstack.org/v1beta1 +kind: NeutronAPI +metadata: + name: neutron +spec: + customServiceConfig: | + [DEFAULT] + debug = false diff --git a/test/kuttl/tests/change_neutron_config/04-cleanup-neutron.yaml b/test/kuttl/tests/change_neutron_config/04-cleanup-neutron.yaml new file mode 120000 index 00000000..553f02bd --- /dev/null +++ b/test/kuttl/tests/change_neutron_config/04-cleanup-neutron.yaml @@ -0,0 +1 @@ +../../common/cleanup-neutron.yaml \ No newline at end of file diff --git a/test/kuttl/tests/change_neutron_config/04-errors.yaml b/test/kuttl/tests/change_neutron_config/04-errors.yaml new file mode 120000 index 00000000..ad072677 --- /dev/null +++ b/test/kuttl/tests/change_neutron_config/04-errors.yaml @@ -0,0 +1 @@ +../../common/errors_cleanup_neutron.yaml \ No newline at end of file diff --git a/test/kuttl/tests/change_neutron_config/deploy/kustomization.yaml b/test/kuttl/tests/change_neutron_config/deploy/kustomization.yaml new file mode 100644 index 00000000..aa457581 --- /dev/null +++ b/test/kuttl/tests/change_neutron_config/deploy/kustomization.yaml @@ -0,0 +1,13 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- ./neutron_v1beta1_neutronapi.yaml +patches: +- patch: |- + - op: replace + path: /spec/secret + value: osp-secret + - op: remove + path: /metadata/namespace + target: + kind: NeutronAPI