From 3d8761d9aacbebcbe113f5dc9d57e2d279255152 Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Wed, 17 Jun 2026 10:05:02 +0300 Subject: [PATCH 1/3] Wait RC to become available --- .github/workflows/coverage_runner.yml | 2 +- tests/hzrc/waitport.py | 47 +++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 tests/hzrc/waitport.py diff --git a/.github/workflows/coverage_runner.yml b/.github/workflows/coverage_runner.yml index ea320d0428..ca2d8beef6 100644 --- a/.github/workflows/coverage_runner.yml +++ b/.github/workflows/coverage_runner.yml @@ -139,7 +139,7 @@ jobs: chmod +x rcd-ubuntu-latest ./rcd-ubuntu-latest -version $HZ_VERSION & # wait for a bit for RCD to download artifacts - sleep 10 + python3 ./tests/hzrc/waitport.py pytest --verbose --cov=hazelcast --cov-report=xml - name: Run tests (Windows) diff --git a/tests/hzrc/waitport.py b/tests/hzrc/waitport.py new file mode 100644 index 0000000000..cdf340d1c1 --- /dev/null +++ b/tests/hzrc/waitport.py @@ -0,0 +1,47 @@ +import asyncio +import socket +import sys + + +class Protocol(asyncio.BaseProtocol): + pass + + +async def connect(host: str, port: int): + loop = asyncio.get_running_loop() + while True: + try: + return await loop.create_connection( + lambda: Protocol(), + host, + port, + family=socket.AF_INET, + ) + except ConnectionRefusedError: + await asyncio.sleep(0.1) + + +async def print_waiting_msg(host, port): + await asyncio.sleep(1) + print(f"Waiting for {host}:{port} to become available...") + + +async def amain(): + host = "127.0.0.1" + port = 9701 + timeout = 120 # seconds + msg_task = asyncio.create_task(print_waiting_msg(host, port)) + + try: + await asyncio.wait_for(connect(host, port), timeout) + except TimeoutError: + print(f"FAILED to connect in {timeout} seconds.") + sys.exit(1) + + msg_task.cancel() + print(f"OK, {host}:{port} is up.") + await asyncio.sleep(1) + + +if __name__ == '__main__': + asyncio.run(amain()) From 8c9f00139bf13d1ee139e61c997f4f7649bfe6bc Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Wed, 17 Jun 2026 10:05:50 +0300 Subject: [PATCH 2/3] black --- tests/hzrc/waitport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/hzrc/waitport.py b/tests/hzrc/waitport.py index cdf340d1c1..5b3022f9db 100644 --- a/tests/hzrc/waitport.py +++ b/tests/hzrc/waitport.py @@ -43,5 +43,5 @@ async def amain(): await asyncio.sleep(1) -if __name__ == '__main__': +if __name__ == "__main__": asyncio.run(amain()) From 9a08476c9a49571c61faa78c375512cd87aca361 Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Wed, 17 Jun 2026 10:10:01 +0300 Subject: [PATCH 3/3] waitport on Windows --- .github/workflows/coverage_runner.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage_runner.yml b/.github/workflows/coverage_runner.yml index ca2d8beef6..4ee215502d 100644 --- a/.github/workflows/coverage_runner.yml +++ b/.github/workflows/coverage_runner.yml @@ -149,7 +149,7 @@ jobs: run: | Start-Process -FilePath .\rcd-windows-latest -ArgumentList '-version', $Env:HZ_VERSION -RedirectStandardOutput rcd-stdout.log -RedirectStandardError rcd-stderr.log # wait for a bit for RCD to download artifacts - sleep 10 + python3 ./tests/hzrc/waitport.py echo "RCD Log:" cat rcd-stdout.log cat rcd-stderr.log