Skip to content

Commit

Permalink
Refactor test
Browse files Browse the repository at this point in the history
  • Loading branch information
afaranha committed Nov 25, 2024
1 parent b4a2ceb commit 161b224
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 155 deletions.
24 changes: 24 additions & 0 deletions tests/kuttl/common/scripts/rotate_token.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh
set -euxo pipefail

wait_rotation() {
while [ $seconds -le 30 ]; do
rotatedat=$(oc get secret keystone -n $NAMESPACE -o jsonpath="{.metadata.annotations['keystone\.openstack\.org/rotatedat']}")
if [ $rotatedat != "2009-11-10T23:00:00Z" ]; then
return
fi
sleep 1
seconds=$(( $seconds + 1 ))
done
}

seconds=1

for i in {1..6}; do
wait_rotation

sleep 20 # make sure a rollout started
oc rollout status deployment/keystone -n $NAMESPACE

oc annotate secret keystone -n $NAMESPACE rotatedat='2009-11-10T23:00:00Z'
done
3 changes: 1 addition & 2 deletions tests/kuttl/common/scripts/test_invalid_token.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ while [ $seconds -le 30 ]; do
seconds=$(( $seconds + 1 ))
done

sleep 20 # make sure a rollout started
#sleep 20 # make sure a rollout started

oc rollout status deployment/keystone -n $NAMESPACE

export OS_TOKEN=$(cat /tmp/temporary_test_token)

alias openstack="oc exec -tn $NAMESPACE openstackclient -- env -u OS_CLOUD - OS_AUTH_URL=http://keystone-public.keystone-kuttl-tests.svc:5000 OS_AUTH_TYPE=token OS_TOKEN=$OS_TOKEN openstack"

echo "DEBUG TOKEN"
openstack endpoint list

if openstack endpoint list 2>&1 | grep "Failed to validate token"; then
Expand Down
153 changes: 0 additions & 153 deletions tests/kuttl/tests/fernet_rotation/03-rotate_keys.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: ../../common/scripts/rotate_token.sh

0 comments on commit 161b224

Please sign in to comment.