diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index b2304d463..3053e947b 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -79,6 +79,8 @@ jobs: run: | poetry run reflex export --backend-only - name: Check run --backend-only before init for counter example + env: + WAIT_FOR_LISTENING_PORT_ARGS: --path /ping run: | poetry run bash scripts/integration.sh ./reflex-examples/counter dev 8001 --backend-only --backend-port 8001 - name: Init Website for counter example diff --git a/scripts/integration.sh b/scripts/integration.sh index dc8b5d553..7095f72d6 100755 --- a/scripts/integration.sh +++ b/scripts/integration.sh @@ -34,4 +34,4 @@ if [ -f /proc/$pid/winpid ]; then echo "Windows detected, passing winpid $pid to port waiter" fi -python scripts/wait_for_listening_port.py $check_ports --timeout=900 --server-pid "$pid" +python scripts/wait_for_listening_port.py $check_ports --timeout=900 --server-pid "$pid" $WAIT_FOR_LISTENING_PORT_OPTS diff --git a/scripts/wait_for_listening_port.py b/scripts/wait_for_listening_port.py index 0bd079476..ccb43fab5 100644 --- a/scripts/wait_for_listening_port.py +++ b/scripts/wait_for_listening_port.py @@ -44,9 +44,9 @@ def _wait_for_port(port, server_pid, timeout) -> Tuple[bool, str]: time.sleep(5) -def _wait_for_http_response(port, server_pid, timeout) -> Tuple[bool, str, str]: +def _wait_for_http_response(port, server_pid, timeout, path) -> Tuple[bool, str, str]: start = time.time() - url = f"http://localhost:{port}" + url = f"http://localhost:{port}{path}" print(f"Waiting for up to {timeout} seconds for {url} to return HTTP response.") while True: try: @@ -75,11 +75,14 @@ def main(): parser.add_argument("port", type=int, nargs="+") parser.add_argument("--timeout", type=int, required=True) parser.add_argument("--server-pid", type=int) + parser.add_argument("--path", type=str, default="/") args = parser.parse_args() start = time.time() executor = ThreadPoolExecutor(max_workers=len(args.port)) futures = [ - executor.submit(_wait_for_http_response, p, args.server_pid, args.timeout) + executor.submit( + _wait_for_http_response, p, args.server_pid, args.timeout, args.path + ) for p in args.port ] base_content = None