diff --git a/tests/integration/defs/common.py b/tests/integration/defs/common.py index 6d82069e990d..4c42032f54e5 100644 --- a/tests/integration/defs/common.py +++ b/tests/integration/defs/common.py @@ -15,6 +15,7 @@ import copy import os import platform +import random import re import socket import tempfile @@ -1162,28 +1163,33 @@ def get_free_port_in_ci(max_attempts=100): Get a free port in the range [CONTAINER_PORT_START, CONTAINER_PORT_START + CONTAINER_PORT_NUM - 1] If CONTAINER_PORT_START and CONTAINER_PORT_NUM are not set or all ports are already in use, fallback to get_free_port """ + global PORTS_IN_USE + container_port_start = int(os.environ.get("CONTAINER_PORT_START", -1)) container_port_num = int(os.environ.get("CONTAINER_PORT_NUM", -1)) if container_port_start != -1 and container_port_num != -1: - for i in range(container_port_num): - port = container_port_start + i - if port in PORTS_IN_USE: - continue + available_ports = [ + port for port in range(container_port_start, container_port_start + + container_port_num) + if port not in PORTS_IN_USE + ] + + for _ in range(len(available_ports)): + # Get a random port from the available ports + port = random.choice(available_ports) # Check if the port is free with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: try: s.bind(("localhost", port)) - - # Port is free, add it to the set of used ports PORTS_IN_USE.add(port) return port except OSError: - # Port is not free, try the next port + available_ports.remove(port) continue # No port found in the range, try to get a random free port from the system - for i in range(max_attempts): + for _ in range(max_attempts): port = get_free_port() if port not in PORTS_IN_USE: PORTS_IN_USE.add(port) diff --git a/tests/integration/test_lists/waives.txt b/tests/integration/test_lists/waives.txt index 44fb7dbd9299..6c0b5aedd276 100644 --- a/tests/integration/test_lists/waives.txt +++ b/tests/integration/test_lists/waives.txt @@ -516,3 +516,4 @@ disaggregated/test_auto_scaling.py::test_worker_restart[etcd-round_robin] SKIP ( accuracy/test_llm_api_pytorch.py::TestGPTOSS::test_eagle3_vswa_reuse_4gpus[one_model] SKIP (https://nvbugs/5756028) accuracy/test_llm_api_pytorch.py::TestGPTOSS::test_eagle3_vswa_reuse_4gpus[two_model] SKIP (https://nvbugs/5756028) accuracy/test_llm_api_pytorch.py::TestQwen3_30B_A3B::test_fp8[latency-torch_compile=False] SKIP (https://nvbugs/5785206) +examples/test_gpt.py::test_llm_gpt2_parallel_embedding_2gpu[float16-0] SKIP (https://nvbugs/5784518)