TUN-4051: Add component-tests to test graceful shutdown

This commit is contained in:
cthuang
2021-03-11 20:43:31 +00:00
parent 848c44bd0b
commit 6a9ba61242
4 changed files with 120 additions and 15 deletions

View File

@@ -4,7 +4,7 @@ import copy
from retrying import retry
from time import sleep
from util import start_cloudflared, wait_tunnel_ready, check_tunnel_not_ready, send_requests
from util import start_cloudflared, wait_tunnel_ready, check_tunnel_not_connected, send_requests
class TestReconnect():
@@ -35,16 +35,17 @@ class TestReconnect():
cloudflared.stdin.flush()
def assert_reconnect(self, config, cloudflared, repeat):
wait_tunnel_ready()
wait_tunnel_ready(tunnel_url=config.get_url())
for _ in range(repeat):
for i in range(self.default_ha_conns):
self.send_reconnect(cloudflared, self.default_reconnect_secs)
expect_connections = self.default_ha_conns-i-1
if expect_connections > 0:
# Don't check if tunnel returns 200 here because there is a race condition between wait_tunnel_ready
# retrying to get 200 response and reconnecting
wait_tunnel_ready(expect_connections=expect_connections)
else:
check_tunnel_not_ready()
check_tunnel_not_connected()
sleep(self.default_reconnect_secs + 10)
wait_tunnel_ready()
send_requests(config.get_url(), 1)
wait_tunnel_ready(tunnel_url=config.get_url())