mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-11-27 08:19:22 +03:00
Update integration test to check that delay is not included in retry.
This commit is contained in:
parent
1c66b2e6cc
commit
132257a579
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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}"
|
||||
|
@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
hurl tests_ok/delay.hurl --delay 1000 --verbose
|
||||
hurl --delay 1000 tests_ok/delay.hurl
|
||||
|
@ -1,3 +1,4 @@
|
||||
Set-StrictMode -Version latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
hurl tests_ok/delay_option.hurl --verbose
|
||||
|
||||
hurl --verbose tests_ok/delay_option.hurl
|
||||
|
@ -1,3 +1,4 @@
|
||||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
hurl tests_ok/delay_option.hurl --verbose
|
||||
|
||||
hurl --verbose tests_ok/delay_option.hurl
|
||||
|
Loading…
Reference in New Issue
Block a user