tests: use an alternative curl request to ensure requests go to the local nginx

The alternative is to rely on DNS and /etc/hosts rules, which isn't quite great because it requires modifying the system.
This commit is contained in:
Jose Diaz-Gonzalez
2023-07-31 12:25:29 -04:00
parent 04905bf553
commit 5717e71755
3 changed files with 14 additions and 6 deletions

View File

@@ -223,6 +223,15 @@ assert_http_success() {
assert_output "200"
}
assert_http_localhost_success() {
local scheme="$1" domain="$2" port="${3:-80}" path="${4:-}"
run curl --connect-to "$domain:$port:localhost:$port" -kSso /dev/null -w "%{http_code}" "$scheme://$domain:$port$path"
echo "curl: curl --connect-to $domain:$port:localhost:$port-kSso /dev/null -w %{http_code} $scheme://$domain:$port$path"
echo "output: $output"
echo "status: $status"
assert_output "200"
}
assert_ssl_domain() {
local domain=$1
assert_app_domain "${domain}"