Skip to content

Commit

Permalink
Merge pull request #313 from brfrenkel/add_kuttl_test
Browse files Browse the repository at this point in the history
Add kuttl test for neutron operator: change neutron debug config
  • Loading branch information
openshift-merge-bot[bot] authored Mar 27, 2024
2 parents e210d19 + 4eb9cd5 commit 9708f9e
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/kuttl/common/scripts/check_debug_in_neutron_pod_logs.sh
Original file line number Diff line number Diff line change
@@ -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 $?
1 change: 1 addition & 0 deletions test/kuttl/tests/change_neutron_config/01-assert.yaml
6 changes: 6 additions & 0 deletions test/kuttl/tests/change_neutron_config/01-deploy-neutron.yaml
Original file line number Diff line number Diff line change
@@ -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 -
6 changes: 6 additions & 0 deletions test/kuttl/tests/change_neutron_config/02-assert.yaml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions test/kuttl/tests/change_neutron_config/03-assert.yaml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: neutron.openstack.org/v1beta1
kind: NeutronAPI
metadata:
name: neutron
spec:
customServiceConfig: |
[DEFAULT]
debug = false
1 change: 1 addition & 0 deletions test/kuttl/tests/change_neutron_config/04-errors.yaml
13 changes: 13 additions & 0 deletions test/kuttl/tests/change_neutron_config/deploy/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9708f9e

Please sign in to comment.