Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion tests/unittest/disaggregated/test_remoteDictionary.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import signal
import socket
import subprocess
import time
import unittest
Expand All @@ -9,6 +10,17 @@
from tensorrt_llm.serve.metadata_server import EtcdDictionary


def wait_for_port(host, port, timeout=15):
start = time.time()
while time.time() - start < timeout:
try:
with socket.create_connection((host, port), timeout=1):
return True
except OSError:
time.sleep(0.5)
raise RuntimeError(f"Timeout waiting for {host}:{port}")


def start_etcd_server():
# Command to start etcd
etcd_cmd = ["etcd"]
Expand All @@ -21,7 +33,6 @@ def start_etcd_server():
preexec_fn=os.setsid) # This makes it run in a new process group

# Wait a bit for etcd to start
time.sleep(5)

return process

Expand All @@ -45,6 +56,8 @@ def setUp(self):
self.host = "localhost"
self.port = 2379

wait_for_port(self.host, self.port)

# Create a clean etcd client for test setup/teardown
self.cleanup_client = etcd3.client(host=self.host, port=self.port)

Expand Down