diff --git a/test/runner.py b/test/runner.py index 9b6fedce..2b4d771a 100755 --- a/test/runner.py +++ b/test/runner.py @@ -201,6 +201,7 @@ def make_metadata_settings(meta, endpoint, prefix): ] raise ValueError("invalid argument: unknown metadata backend: '%s'" % meta) + def check_vineyard_for_ready(rpc_socket_port, timeout=60): """Check if vineyardd and internal etcd is ready.""" ready = False @@ -210,8 +211,11 @@ def check_vineyard_for_ready(rpc_socket_port, timeout=60): cmd = f"lsof -i :{rpc_socket_port}" result = subprocess.run(cmd, shell=True, capture_output=True, text=True) lines = result.stdout.strip().split('\n') - process_count = len(lines) - 1 if lines[0].startswith('COMMAND') else len(lines) - # If there are two processes listening on the rpc socket port, it means vineyardd and internal etcd are ready. + process_count = ( + len(lines) - 1 if lines[0].startswith('COMMAND') else len(lines) + ) + # If there are two processes listening on the rpc socket port, + # it means vineyardd and internal etcd are ready. if process_count == 2: ready = True except Exception as e: @@ -219,6 +223,7 @@ def check_vineyard_for_ready(rpc_socket_port, timeout=60): time.sleep(1) return ready + @contextlib.contextmanager def start_vineyardd( metadata_settings, @@ -270,6 +275,7 @@ def start_vineyardd( time.sleep(1) yield proc_context, rpc_socket_port + @contextlib.contextmanager def start_multiple_vineyardd( metadata_settings, @@ -502,8 +508,8 @@ def run_vineyard_cpp_tests(meta, allocator, endpoints, tests): def run_vineyard_spill_tests(meta, allocator, endpoints, tests): meta_prefix = 'vineyard_test_%s' % time.time() - #client_port = find_port() - #endpoints = 'http://127.0.0.1:%d' % client_port + # client_port = find_port() + # endpoints = 'http://127.0.0.1:%d' % client_port metadata_settings = make_metadata_settings(meta, endpoints, meta_prefix) with start_vineyardd( metadata_settings,