Update integration test to check that delay is not included in retry.

This commit is contained in:
Jean-Christophe Amiel 2024-06-19 13:24:22 +02:00
parent 1c66b2e6cc
commit 132257a579
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC
6 changed files with 41 additions and 9 deletions

View File

@ -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

View File

@ -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

View File

@ -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}"

View File

@ -1,3 +1,3 @@
#!/bin/bash
set -Eeuo pipefail
hurl tests_ok/delay.hurl --delay 1000 --verbose
hurl --delay 1000 tests_ok/delay.hurl

View File

@ -1,3 +1,4 @@
Set-StrictMode -Version latest
$ErrorActionPreference = 'Stop'
hurl tests_ok/delay_option.hurl --verbose
hurl --verbose tests_ok/delay_option.hurl

View File

@ -1,3 +1,4 @@
#!/bin/bash
set -Eeuo pipefail
hurl tests_ok/delay_option.hurl --verbose
hurl --verbose tests_ok/delay_option.hurl