diff --git a/integration/hurl/tests_ok/delay.hurl b/integration/hurl/tests_ok/delay.hurl index 9c3187535..bdd623d2b 100644 --- a/integration/hurl/tests_ok/delay.hurl +++ b/integration/hurl/tests_ok/delay.hurl @@ -2,10 +2,24 @@ GET http://localhost:8000/delay-init HTTP 200 -# This request must reach the server at least 1000ms after the previous request -GET http://localhost:8000/delay -HTTP 200 # This request must reach the server at least 1000ms after the previous request GET http://localhost:8000/delay HTTP 200 + + +# This request must reach the server at least 1000ms after the previous request +GET http://localhost:8000/delay +HTTP 200 + + +# This request must reach the server at least 1000ms after the previous request +# We artificially trigger retry to test that the delay is NOT add for each retry. +GET http://localhost:8000/delay-and-retry +[Options] +retry: 10 +retry-interval: 10 +HTTP 200 +[Asserts] +body toInt > 5 # Trigger a retry for 5 requests + diff --git a/integration/hurl/tests_ok/delay.ps1 b/integration/hurl/tests_ok/delay.ps1 index 0dcd00f42..cfb8449cc 100644 --- a/integration/hurl/tests_ok/delay.ps1 +++ b/integration/hurl/tests_ok/delay.ps1 @@ -1,3 +1,3 @@ Set-StrictMode -Version latest $ErrorActionPreference = 'Stop' -hurl tests_ok/delay.hurl --delay 1000 --verbose +hurl --delay 1000 tests_ok/delay.hurl diff --git a/integration/hurl/tests_ok/delay.py b/integration/hurl/tests_ok/delay.py index c8a3db2cb..3706bb4c3 100644 --- a/integration/hurl/tests_ok/delay.py +++ b/integration/hurl/tests_ok/delay.py @@ -3,11 +3,14 @@ from datetime import datetime last = None +counter = 0 + @app.route("/delay-init") def delay_init(): - global last + global last, counter last = datetime.now() + counter = 0 return "" @@ -15,6 +18,19 @@ def delay_init(): def delay(): global last diff = (datetime.now() - last).total_seconds() - assert diff > 1 + assert 1 < diff < 2 last = datetime.now() return "" + + +@app.route("/delay-and-retry") +def delay_and_retry(): + global last, counter + counter += 1 + + if counter > 5: + diff = (datetime.now() - last).total_seconds() + assert 1 < diff < 3 + last = datetime.now() + + return f"{counter}" diff --git a/integration/hurl/tests_ok/delay.sh b/integration/hurl/tests_ok/delay.sh index 1a060cb4c..ec0af5dae 100755 --- a/integration/hurl/tests_ok/delay.sh +++ b/integration/hurl/tests_ok/delay.sh @@ -1,3 +1,3 @@ #!/bin/bash set -Eeuo pipefail -hurl tests_ok/delay.hurl --delay 1000 --verbose +hurl --delay 1000 tests_ok/delay.hurl diff --git a/integration/hurl/tests_ok/delay_option.ps1 b/integration/hurl/tests_ok/delay_option.ps1 index 12561ffba..934ac7324 100644 --- a/integration/hurl/tests_ok/delay_option.ps1 +++ b/integration/hurl/tests_ok/delay_option.ps1 @@ -1,3 +1,4 @@ Set-StrictMode -Version latest $ErrorActionPreference = 'Stop' -hurl tests_ok/delay_option.hurl --verbose + +hurl --verbose tests_ok/delay_option.hurl diff --git a/integration/hurl/tests_ok/delay_option.sh b/integration/hurl/tests_ok/delay_option.sh index b241049ea..57b75e5a8 100755 --- a/integration/hurl/tests_ok/delay_option.sh +++ b/integration/hurl/tests_ok/delay_option.sh @@ -1,3 +1,4 @@ #!/bin/bash set -Eeuo pipefail -hurl tests_ok/delay_option.hurl --verbose + +hurl --verbose tests_ok/delay_option.hurl