Skip to content

Commit

Permalink
DXCDT-414: Custom domains integration tests (#690)
Browse files Browse the repository at this point in the history
* More reliable tests

* Fixing test case

* Adding tests, cleanup and get domain ID script

* Separating test domain into var

* Fix

* Removing potentially erroneous verify assertion

---------

Co-authored-by: Will Vedder <[email protected]>
  • Loading branch information
willvedd and willvedd authored Mar 30, 2023
1 parent 2d5566d commit dd8d33b
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 3 deletions.
73 changes: 73 additions & 0 deletions test/integration/custom-domains-test-cases.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
config:
inherit-env: true
tests:
001 - list domains:
command: auth0 domains list
exit-code: 0
002 - create domain with minimal flags:
command: auth0 domains create --domain "integration-test.com" --no-input
exit-code: 0
stdout:
contains:
- "ID cd_"
- "DOMAIN integration-test.com"
- "STATUS pending_verification"
- "PROVISIONING TYPE auth0_managed_certs"
003 - unsuccessfully create domain with same name:
command: auth0 domains create --domain "integration-test.com" --no-input
exit-code: 1
stderr:
contains:
- "An unexpected error occurred while attempting to create the custom domain 'integration-test.com': 409 Conflict: The specified custom domain already exists"
004 - show domain:
command: auth0 domains show $(./test/integration/scripts/get-custom-domain-id.sh) --no-input
exit-code: 0
stdout:
contains:
- "ID cd_"
- "DOMAIN integration-test.com"
- "STATUS pending_verification"
- "PROVISIONING TYPE auth0_managed_certs"
005 - update domain minimal flags:
command: auth0 domains update $(./test/integration/scripts/get-custom-domain-id.sh) --no-input
exit-code: 0
stdout:
contains:
- "ID cd_"
- "DOMAIN integration-test.com"
- "STATUS pending_verification"
- "PROVISIONING TYPE auth0_managed_certs"
006 - update domain maximal flags:
command: auth0 domains update $(./test/integration/scripts/get-custom-domain-id.sh) --policy recommended --no-input
exit-code: 0
stdout:
contains:
- "ID cd_"
- "DOMAIN integration-test.com"
- "STATUS pending_verification"
- "PROVISIONING TYPE auth0_managed_certs"
- "TLS POLICY recommended"
007 - verify domain:
command: auth0 domains update $(./test/integration/scripts/get-custom-domain-id.sh) --policy recommended --no-input
exit-code: 0
stdout:
contains:
- "ID cd_"
- "DOMAIN integration-test.com"
- "PROVISIONING TYPE auth0_managed_certs"
- "TLS POLICY recommended"
008 - delete domain:
command: auth0 domains delete $(./test/integration/scripts/get-custom-domain-id.sh) --no-input
exit-code: 0
009 - create domain with maximal flags:
command: auth0 domains create --domain "integration-test.com" --verification txt --type auth0 --policy recommended --no-input
exit-code: 0
stdout:
contains:
- "ID cd_"
- "DOMAIN integration-test.com"
- "STATUS pending_verification"
- "PROVISIONING TYPE auth0_managed_certs"
- "VERIFICATION METHOD txt"
- "TLS POLICY recommended"
- "CUSTOM CLIENT IP HEADER"
20 changes: 20 additions & 0 deletions test/integration/scripts/get-custom-domain-id.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#! /bin/bash

testing_domain_name="integration-test.com"

domains=$( auth0 domains list --json --no-input )
for domain in $( printf "%s" "$domains" | jq -r '.[] | @base64' ); do
_jq() {
echo "${domain}" | base64 --decode | jq -r "${1}"
}

id=$(_jq '.custom_domain_id')
name=$(_jq '.domain')

if [[ $name = $testing_domain_name ]]
then
echo $id
exit 0
fi
exit 1
done
2 changes: 2 additions & 0 deletions test/integration/scripts/test-cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ for action in $( echo "${actions}" | jq -r '.[] | @base64' ); do
fi
done

auth0 domains delete $(./test/integration/scripts/get-custom-domain-id.sh) --no-input

# Reset universal login branding
auth0 ul update --accent "#2A2E35" --background "#FF4F40" --logo "https://example.com/logo.png" --favicon "https://example.com/favicon.png" --font https://example.com/font.woff --no-input

Expand Down
3 changes: 0 additions & 3 deletions test/integration/test-cases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ tests:
auth0 rules list:
exit-code: 0

auth0 domains list:
exit-code: 0

auth0 quickstarts list:
exit-code: 0

Expand Down

0 comments on commit dd8d33b

Please sign in to comment.