Skip to content

Commit

Permalink
Fix all kuttl asserts
Browse files Browse the repository at this point in the history
These tests were not running, and need fixing either due to changes in
endpoint names, or incorrect regex patterns.
  • Loading branch information
steveb committed Jun 21, 2024
1 parent a7f0645 commit 58c4c8e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/kuttl/common/assert-endpoints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ commands:
- script: |
set -euxo pipefail
template='{{.status.apiEndpoints.ironic.public}}{{":"}}{{.status.apiEndpoints.ironic.internal}}{{"\n"}}'
regex="http:\/\/ironic-public-$NAMESPACE\.apps.*:http:\/\/ironic-admin-$NAMESPACE\.apps.*:http:\/\/ironic-internal-$NAMESPACE\.apps.*"
regex="http:\/\/ironic-public\.$NAMESPACE\..*:http:\/\/ironic-internal\.$NAMESPACE\..*"
apiEndpoints=$(oc get -n $NAMESPACE ironics.ironic.openstack.org ironic -o go-template="$template")
matches=$(echo "$apiEndpoints" | sed -e "s?$regex??")
if [ -z "$matches" ]; then
Expand All @@ -30,7 +30,7 @@ commands:
- script: |
set -euxo pipefail
template='{{index .status.apiEndpoints "ironic-inspector" "public"}}{{":"}}{{index .status.apiEndpoints "ironic-inspector" "internal"}}{{"\n"}}'
regex="http:\/\/ironic-inspector-public-$NAMESPACE\.apps.*:http:\/\/ironic-inspector-admin-$NAMESPACE\.apps.*:http:\/\/ironic-inspector-internal-$NAMESPACE\.apps.*"
regex="http:\/\/ironic-inspector-public\.$NAMESPACE\..*:http:\/\/ironic-inspector-internal\.$NAMESPACE\..*"
apiEndpoints=$(oc get -n $NAMESPACE ironics.ironic.openstack.org ironic -o go-template="$template")
matches=$(echo "$apiEndpoints" | sed -e "s?$regex??")
if [ -z "$matches" ]; then
Expand Down
6 changes: 4 additions & 2 deletions tests/kuttl/tests/deploy_tls/10-assert-deploy-ironic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,23 @@ commands:
- script: |
set -euxo pipefail
template='{{.spec.endpoints.internal}}{{":"}}{{.spec.endpoints.public}}{{"\n"}}'
regex="https:\/\/ironic-internal.$NAMESPACE.*:https:\/\/ironic-public.$NAMESPACE.*"
regex="https:\/\/ironic-internal\.$NAMESPACE\..*:https:\/\/ironic-public\.$NAMESPACE\..*"
apiEndpoints=$(oc get -n $NAMESPACE KeystoneEndpoint ironic -o go-template="$template")
matches=$(echo "$apiEndpoints" | sed -e "s?$regex??")
if [[ -n "$matches" ]]; then
exit 1
fi
exit 0
# the actual addresses of the api endpoints are platform specific, so we can't rely on
# kuttl asserts to check them. This short script gathers the addresses and checks that
# the two endpoints are defined and their addresses follow the default pattern
- script: |
set -euxo pipefail
template='{{.spec.endpoints.internal}}{{":"}}{{.spec.endpoints.public}}{{"\n"}}'
regex="https:\/\/ironic-inspector-internal.$NAMESPACE.*:https:\/\/ironic-inspector-public.$NAMESPACE.*"
regex="https:\/\/ironic-inspector-internal\.$NAMESPACE\..*:https:\/\/ironic-inspector-public\.$NAMESPACE\..*"
apiEndpoints=$(oc get -n $NAMESPACE KeystoneEndpoint ironic-inspector -o go-template="$template")
matches=$(echo "$apiEndpoints" | sed -e "s?$regex??")
if [[ -n "$matches" ]]; then
exit 1
fi
exit 0

0 comments on commit 58c4c8e

Please sign in to comment.