mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-11-27 08:19:22 +03:00
Split test aws_sig test into ok/failed
This commit is contained in:
parent
715a56a208
commit
b1e2e1624c
6
integration/tests_failed/aws_sigv4.err
Executable file
6
integration/tests_failed/aws_sigv4.err
Executable file
@ -0,0 +1,6 @@
|
||||
error: HTTP connection
|
||||
--> tests_ok/aws_sigv4.hurl:1:6
|
||||
|
|
||||
1 | POST http://localhost:8000/aws-sigv4
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Option aws-sigv4 requires libcurl version 7.75.0 or higher
|
||||
|
|
1
integration/tests_failed/aws_sigv4.exit
Executable file
1
integration/tests_failed/aws_sigv4.exit
Executable file
@ -0,0 +1 @@
|
||||
3
|
15
integration/tests_failed/aws_sigv4.sh
Executable file
15
integration/tests_failed/aws_sigv4.sh
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
|
||||
set +eo pipefail
|
||||
# Check error message when curl/libcurl on this system does not support --aws-sigv4
|
||||
# simply ignore test if option is available on the system
|
||||
# FIXME: remove this test once all integration test targets have aws-sigv4 support in libcurl
|
||||
if curl --aws-sigv4 2>&1 | grep -qv 'option --aws-sigv4: is unknown'; then
|
||||
cat tests_failed/aws_sigv4.err >&2
|
||||
exit 3
|
||||
fi
|
||||
|
||||
set -Eeuo pipefail
|
||||
hurl --user someAccessKeyId:someSecretKey tests_ok/aws_sigv4.hurl
|
@ -1 +0,0 @@
|
||||
Received SigV4 Authorization header
|
@ -10,4 +10,4 @@ def aws_sigv4():
|
||||
r"^AWS4-HMAC-SHA256 Credential=someAccessKeyId/\d+/eu-central-1/hurltest/aws4_request, SignedHeaders=\S+, Signature=[a-f0-9]+$",
|
||||
auth,
|
||||
)
|
||||
return "Received SigV4 Authorization header"
|
||||
return ""
|
||||
|
@ -1,26 +1,13 @@
|
||||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
set +eo pipefail
|
||||
# if curl/libcurl on this system does not support --aws-sigv4
|
||||
# simply ignore test
|
||||
# FIXME: remove this workaround once all integration test targets have aws-sigv4 support in libcurl
|
||||
#
|
||||
# for integration test targets that come with a too old libcurl, we accept the appropriate error
|
||||
# message and fake the correct result (but only if `curl` doesn't know about `--aws-sigv4` either!).
|
||||
|
||||
set +e
|
||||
output_curl=$(curl --aws-sigv4 2>&1)
|
||||
output_hurl=$(hurl --user someAccessKeyId:someSecretKey tests_ok/aws_sigv4.hurl 2>&1 )
|
||||
rc="$?"
|
||||
set -e
|
||||
|
||||
if echo "$output_curl" | grep -q 'option --aws-sigv4: is unknown'; then
|
||||
# curl on this system does not support --aws-sigv4, so check for the expected error message
|
||||
|
||||
if echo "$output_hurl" | grep -q "Option aws-sigv4 requires libcurl version 7.75.0 or higher"; then
|
||||
cat tests_ok/aws_sigv4.out
|
||||
exit 0
|
||||
fi
|
||||
if curl --aws-sigv4 2>&1 | grep -q 'option --aws-sigv4: is unknown'; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -n "$output_hurl"
|
||||
exit "$rc"
|
||||
|
||||
set -Eeuo pipefail
|
||||
hurl --user someAccessKeyId:someSecretKey tests_ok/aws_sigv4.hurl
|
||||
|
Loading…
Reference in New Issue
Block a user