Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions test/kuttl/common/assert_sample_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ spec:
memory: 500Mi
secret: osp-secret
status:
databaseHostname: openstack.keystone-kuttl-tests.svc
readyCount: 1
---
apiVersion: apps/v1
Expand Down Expand Up @@ -141,12 +140,21 @@ apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- script: |
# Verify databaseHostname matches the expected namespace-based pattern
dbHostTemplate='{{.status.databaseHostname}}'
dbHostname=$(oc get -n $NAMESPACE KeystoneAPI keystone -o go-template="$dbHostTemplate")
expectedDbHostname="openstack.$NAMESPACE.svc"
if [ "$dbHostname" != "$expectedDbHostname" ]; then
echo "databaseHostname mismatch: got '$dbHostname', expected '$expectedDbHostname'"
exit 1
fi

# the actual addresses of the apiEndpoints are platform specific, so we can't rely on
# kuttl asserts to check them. This short script gathers the addresses and checks that
# the three endpoints are defined and their addresses follow the default pattern
template='{{.status.apiEndpoints.internal}}{{":"}}{{.status.apiEndpoints.public}}{{"\n"}}'
regex="http:\/\/keystone-internal.$NAMESPACE.*:http:\/\/keystone-public.$NAMESPACE.*"
apiEndpoints=$(oc get -n $NAMESPACE KeystoneAPI keystone -o go-template="$template")
apiEndpoints=$(oc get -n $NAMESPACE KeystoneAPI keystone -o go-template="$template")
matches=$(echo "$apiEndpoints" | sed -e "s?$regex??")
if [ -z "$matches" ]; then
exit 0
Expand Down
2 changes: 1 addition & 1 deletion test/kuttl/common/scripts/rotate_token.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ apiVersion: v1
kind: Secret
metadata:
name: keystone
namespace: keystone-kuttl-tests
namespace: $NAMESPACE
annotations:
keystone.openstack.org/rotatedat: "2009-11-10T23:00:00Z"
EOF
Expand Down
2 changes: 1 addition & 1 deletion test/kuttl/common/scripts/test_invalid_token.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -x

export OS_TOKEN=$(cat /tmp/temporary_test_token)

output=$(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 endpoint list 2>&1)
output=$(oc exec -tn $NAMESPACE openstackclient -- env -u OS_CLOUD - OS_AUTH_URL=http://keystone-public.$NAMESPACE.svc:5000 OS_AUTH_TYPE=token OS_TOKEN=$OS_TOKEN openstack endpoint list 2>&1)

filtered_output=$(echo "$output" | grep -i "Could not recognize Fernet token")

Expand Down
2 changes: 1 addition & 1 deletion test/kuttl/common/scripts/validate_test_token.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sleep 60

export OS_TOKEN=$(cat /tmp/temporary_test_token)

output=$(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 endpoint list 2>&1 || true)
output=$(oc exec -tn $NAMESPACE openstackclient -- env -u OS_CLOUD - OS_AUTH_URL=http://keystone-public.$NAMESPACE.svc:5000 OS_AUTH_TYPE=token OS_TOKEN=$OS_TOKEN openstack endpoint list 2>&1 || true)

if echo "$output" | grep -qi "Could not recognize Fernet token"; then
exit 1
Expand Down
14 changes: 12 additions & 2 deletions test/kuttl/tests/keystone_scale/03-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,18 @@ spec:
cpu: "1"
memory: 500Mi
secret: osp-secret
status:
databaseHostname: openstack.keystone-kuttl-tests.svc
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- script: |
dbHostTemplate='{{.status.databaseHostname}}'
dbHostname=$(oc get -n $NAMESPACE KeystoneAPI keystone -o go-template="$dbHostTemplate")
expectedDbHostname="openstack.$NAMESPACE.svc"
if [ "$dbHostname" != "$expectedDbHostname" ]; then
echo "databaseHostname mismatch: got '$dbHostname', expected '$expectedDbHostname'"
exit 1
fi
---
apiVersion: apps/v1
kind: Deployment
Expand Down
10 changes: 9 additions & 1 deletion test/kuttl/tests/keystone_tls/01-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ spec:
secretName: cert-keystone-public-svc
caBundleSecretName: combined-ca-bundle
status:
databaseHostname: openstack.keystone-kuttl-tests.svc
readyCount: 1
---
apiVersion: apps/v1
Expand Down Expand Up @@ -124,6 +123,15 @@ apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- script: |
# Verify databaseHostname matches the expected namespace-based pattern
dbHostTemplate='{{.status.databaseHostname}}'
dbHostname=$(oc get -n $NAMESPACE KeystoneAPI keystone -o go-template="$dbHostTemplate")
expectedDbHostname="openstack.$NAMESPACE.svc"
if [ "$dbHostname" != "$expectedDbHostname" ]; then
echo "databaseHostname mismatch: got '$dbHostname', expected '$expectedDbHostname'"
exit 1
fi

# the actual addresses of the apiEndpoints are platform specific, so we can't rely on
# kuttl asserts to check them. This short script gathers the addresses and checks that
# the three endpoints are defined and their addresses follow the default pattern
Expand Down
Loading