Skip to content

Commit

Permalink
Add kuttl test assert to check Horizon route
Browse files Browse the repository at this point in the history
This change adds a Kuttl test assertion to ensure the Horizon route is
responding to curl requests with the appropriate HTTP status codes.

Signed-off-by: Brendan Shephard <[email protected]>
  • Loading branch information
bshephar committed Jul 6, 2023
1 parent 8ef2724 commit 6c26e1c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/kuttl/common/assert-sample-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,19 @@ spec:
SESSION_TIMEOUT = 3600
status:
readyCount: 1
---
# Test the status code is correct for each endpoint
# This test is for heat endpoints
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- script: |
set -x
RETURN_CODE=0
PUBLIC_URL=$(oc get route -n $NAMESPACE horizon-public -o jsonpath='{.status.ingress[0].host}')
STATUSCODE=$(curl --silent --output /dev/stderr --head --write-out "%{http_code}" $PUBLIC_URL/dashboard/auth/login/?next=/dashboard/")
if test $STATUSCODE -ne 204; then
RETURN_CODE=1
echo "${PUBLIC_URL} status code expected is 200 but was ${STATUSCODE}"
fi
exit $RETURN_CODE

0 comments on commit 6c26e1c

Please sign in to comment.