From c90d5531f2eb44b5f3da3e4aee8db4fb44b40369 Mon Sep 17 00:00:00 2001 From: Ye Cao Date: Tue, 2 Jul 2024 15:33:07 +0800 Subject: [PATCH] Lint python code Signed-off-by: Ye Cao --- test/runner.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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,