From b1e2e1624cbd097b9b87aca9b1a39c937e2d9d8b Mon Sep 17 00:00:00 2001 From: Fabrice Reix Date: Sat, 2 Sep 2023 10:16:24 +0200 Subject: [PATCH] Split test aws_sig test into ok/failed --- integration/tests_failed/aws_sigv4.err | 6 ++++++ integration/tests_failed/aws_sigv4.exit | 1 + integration/tests_failed/aws_sigv4.sh | 15 ++++++++++++++ integration/tests_ok/aws_sigv4.out | 1 - integration/tests_ok/aws_sigv4.py | 2 +- integration/tests_ok/aws_sigv4.sh | 27 +++++++------------------ 6 files changed, 30 insertions(+), 22 deletions(-) create mode 100755 integration/tests_failed/aws_sigv4.err create mode 100755 integration/tests_failed/aws_sigv4.exit create mode 100755 integration/tests_failed/aws_sigv4.sh delete mode 100644 integration/tests_ok/aws_sigv4.out diff --git a/integration/tests_failed/aws_sigv4.err b/integration/tests_failed/aws_sigv4.err new file mode 100755 index 000000000..49b0ae8b1 --- /dev/null +++ b/integration/tests_failed/aws_sigv4.err @@ -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 + | diff --git a/integration/tests_failed/aws_sigv4.exit b/integration/tests_failed/aws_sigv4.exit new file mode 100755 index 000000000..00750edc0 --- /dev/null +++ b/integration/tests_failed/aws_sigv4.exit @@ -0,0 +1 @@ +3 diff --git a/integration/tests_failed/aws_sigv4.sh b/integration/tests_failed/aws_sigv4.sh new file mode 100755 index 000000000..5c0b27e28 --- /dev/null +++ b/integration/tests_failed/aws_sigv4.sh @@ -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 diff --git a/integration/tests_ok/aws_sigv4.out b/integration/tests_ok/aws_sigv4.out deleted file mode 100644 index f1346d529..000000000 --- a/integration/tests_ok/aws_sigv4.out +++ /dev/null @@ -1 +0,0 @@ -Received SigV4 Authorization header \ No newline at end of file diff --git a/integration/tests_ok/aws_sigv4.py b/integration/tests_ok/aws_sigv4.py index 49dffad2b..4c9bf9762 100644 --- a/integration/tests_ok/aws_sigv4.py +++ b/integration/tests_ok/aws_sigv4.py @@ -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 "" diff --git a/integration/tests_ok/aws_sigv4.sh b/integration/tests_ok/aws_sigv4.sh index bbef0bafc..e2b788f44 100755 --- a/integration/tests_ok/aws_sigv4.sh +++ b/integration/tests_ok/aws_sigv4.sh @@ -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