Skip to content

Commit

Permalink
Merge pull request #153 from cescgina/kuttl_change_config
Browse files Browse the repository at this point in the history
Add kuttl tests to check keystone config changes
  • Loading branch information
openshift-merge-robot authored Mar 2, 2023
2 parents fb32820 + 7900b00 commit b4b2a35
Show file tree
Hide file tree
Showing 14 changed files with 116 additions and 108 deletions.
6 changes: 3 additions & 3 deletions api/bases/keystone.openstack.org_keystoneapis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ spec:
additionalProperties:
type: string
description: 'ConfigOverwrite - interface to overwrite default config
files like e.g. logging.conf or policy.json. But can also be used
to add additional files. Those get added to the service config dir
in /etc/<service> . TODO: -> implement'
files like e.g. policy.json. But can also be used to add additional
files. Those get added to the service config dir in /etc/<service>
. TODO: -> implement'
type: object
externalEndpoints:
description: ExternalEndpoints, expose a VIP using a pre-created IPAddressPool
Expand Down
4 changes: 2 additions & 2 deletions config/crd/bases/keystone.openstack.org_keystoneapis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ spec:
type: string
description: 'ConfigOverwrite - interface to overwrite default config
files like e.g. policy.json. But can also be used to add additional
files. Those get added to the service config dir in /etc/<service>.
TODO: -> implement'
files. Those get added to the service config dir in /etc/<service>
. TODO: -> implement'
type: object
externalEndpoints:
description: ExternalEndpoints, expose a VIP using a pre-created IPAddressPool
Expand Down
6 changes: 6 additions & 0 deletions tests/kuttl/common/cleanup-keystone.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
PWD=$INSTALL_YAMLS
make -C $INSTALL_YAMLS keystone_deploy_cleanup
6 changes: 6 additions & 0 deletions tests/kuttl/common/deploy_keystone.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
PWD=$INSTALL_YAMLS
make -C $INSTALL_YAMLS keystone_deploy
58 changes: 58 additions & 0 deletions tests/kuttl/common/errors_cleanup_keystone.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#
# Check for:
#
# No KeystoneAPI CR
# No Deployment for KeystoneAPI CR
# No Pods in keystone Deployment
# No Keystone Services
# No Keystone Routes
#
apiVersion: keystone.openstack.org/v1beta1
kind: KeystoneAPI
metadata:
finalizers:
- KeystoneAPI
name: keystone
namespace: openstack
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: keystone
namespace: openstack
---
# the openshift annotations can't be checked through the deployment above
apiVersion: v1
kind: Pod
metadata:
annotations:
openshift.io/scc: anyuid
labels:
service: keystone
---
apiVersion: v1
kind: Service
metadata:
labels:
internal: "true"
service: keystone
name: keystone-internal
namespace: openstack
---
apiVersion: v1
kind: Service
metadata:
labels:
public: "true"
service: keystone
name: keystone-public
namespace: openstack
---
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: keystone-public
labels:
public: "true"
service: keystone
namespace: openstack
20 changes: 20 additions & 0 deletions tests/kuttl/common/scripts/check_debug_in_keystone_pod_logs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh
#
found=0
not_found=1
if [ "$1" == "--reverse" ];then
# sometimes we want to check that there is no DEBUG logs
found=1
not_found=0
fi

pod=$(oc get pods -n openstack -l service=keystone -o name)
# in the case the logs have DEBUG lines, keep only one to avoid cluttering the
# test output
debug=$(oc logs -n openstack "$pod" | grep "DEBUG" | head -n 1)

if [ -n "$debug" ]; then
exit $found
else
exit $not_found
fi
1 change: 1 addition & 0 deletions tests/kuttl/tests/change_keystone_config/01-assert.yaml
6 changes: 6 additions & 0 deletions tests/kuttl/tests/change_keystone_config/02-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# check that by default, debug is not set in keystone config
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
namespaced: true
commands:
- script: $KEYSTONE_KUTTL_DIR/../common/scripts/check_debug_in_keystone_pod_logs.sh
5 changes: 5 additions & 0 deletions tests/kuttl/tests/change_keystone_config/03-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
namespaced: true
commands:
- script: $KEYSTONE_KUTTL_DIR/../common/scripts/check_debug_in_keystone_pod_logs.sh --reverse
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
oc patch keystoneapi -n openstack keystone --type='json' -p='[{"op": "replace", "path": "/spec/customServiceConfig", "value": "[DEFAULT]\ndebug = false"}]'
6 changes: 0 additions & 6 deletions tests/kuttl/tests/keystone_scale/01-deploy-keystone.yaml

This file was deleted.

1 change: 1 addition & 0 deletions tests/kuttl/tests/keystone_scale/01-deploy-keystone.yaml
6 changes: 0 additions & 6 deletions tests/kuttl/tests/keystone_scale/05-cleanup-keystone.yaml

This file was deleted.

1 change: 1 addition & 0 deletions tests/kuttl/tests/keystone_scale/05-cleanup-keystone.yaml
91 changes: 0 additions & 91 deletions tests/kuttl/tests/keystone_scale/05-errors.yaml

This file was deleted.

1 change: 1 addition & 0 deletions tests/kuttl/tests/keystone_scale/05-errors.yaml

0 comments on commit b4b2a35

Please sign in to comment.