TUN-4089: Address flakiness in component tests for termination
This commit is contained in:
parent
39901e1d60
commit
d67fbbf94f
|
@ -50,9 +50,9 @@ class TestTermination():
|
||||||
target=self.stream_request, args=(config, connected, True, ))
|
target=self.stream_request, args=(config, connected, True, ))
|
||||||
in_flight_req.start()
|
in_flight_req.start()
|
||||||
|
|
||||||
with self.within_grace_period():
|
|
||||||
with connected:
|
with connected:
|
||||||
connected.wait(self.timeout)
|
connected.wait(self.timeout)
|
||||||
|
with self.within_grace_period():
|
||||||
# Send signal after the SSE connection is established
|
# Send signal after the SSE connection is established
|
||||||
self.terminate_by_signal(cloudflared, sig)
|
self.terminate_by_signal(cloudflared, sig)
|
||||||
self.wait_eyeball_thread(in_flight_req, self.grace_period)
|
self.wait_eyeball_thread(in_flight_req, self.grace_period)
|
||||||
|
|
|
@ -67,8 +67,12 @@ def wait_tunnel_ready(tunnel_url=None, require_min_connections=1):
|
||||||
def check_tunnel_not_connected():
|
def check_tunnel_not_connected():
|
||||||
url = f'http://localhost:{METRICS_PORT}/ready'
|
url = f'http://localhost:{METRICS_PORT}/ready'
|
||||||
|
|
||||||
|
try:
|
||||||
resp = requests.get(url, timeout=1)
|
resp = requests.get(url, timeout=1)
|
||||||
assert resp.status_code == 503, f"Expect {url} returns 503, got {resp.status_code}"
|
assert resp.status_code == 503, f"Expect {url} returns 503, got {resp.status_code}"
|
||||||
|
# cloudflared might already terminate
|
||||||
|
except requests.exceptions.ConnectionError as e:
|
||||||
|
LOGGER.warning(f"Failed to connect to {url}, error: {e}")
|
||||||
|
|
||||||
|
|
||||||
# In some cases we don't need to check response status, such as when sending batch requests to generate logs
|
# In some cases we don't need to check response status, such as when sending batch requests to generate logs
|
||||||
|
|
Loading…
Reference in New Issue