From 47b8d0411d5c83bf8f66957e53744a07cfeb40a9 Mon Sep 17 00:00:00 2001 From: Saarthak Mohan Date: Tue, 11 Mar 2025 14:18:01 -0500 Subject: [PATCH 1/2] Make each product use their own gRPC Device Server ports --- src/nidcpower/system_tests/grpc_server_config.json | 9 +++++++++ src/nidcpower/system_tests/test_system_nidcpower.py | 4 +++- src/nidigital/system_tests/grpc_server_config.json | 9 +++++++++ src/nidigital/system_tests/test_system_nidigital.py | 4 +++- src/nidmm/system_tests/grpc_server_config.json | 9 +++++++++ src/nidmm/system_tests/test_system_nidmm.py | 4 +++- src/nifgen/system_tests/grpc_server_config.json | 9 +++++++++ src/nifgen/system_tests/test_system_nifgen.py | 4 +++- src/niscope/system_tests/grpc_server_config.json | 9 +++++++++ src/niscope/system_tests/test_system_niscope.py | 4 +++- src/niswitch/system_tests/grpc_server_config.json | 9 +++++++++ src/niswitch/system_tests/test_system_niswitch.py | 4 +++- src/shared/system_test_utilities.py | 4 ++-- 13 files changed, 74 insertions(+), 8 deletions(-) create mode 100644 src/nidcpower/system_tests/grpc_server_config.json create mode 100644 src/nidigital/system_tests/grpc_server_config.json create mode 100644 src/nidmm/system_tests/grpc_server_config.json create mode 100644 src/nifgen/system_tests/grpc_server_config.json create mode 100644 src/niscope/system_tests/grpc_server_config.json create mode 100644 src/niswitch/system_tests/grpc_server_config.json diff --git a/src/nidcpower/system_tests/grpc_server_config.json b/src/nidcpower/system_tests/grpc_server_config.json new file mode 100644 index 000000000..5e6da6c3c --- /dev/null +++ b/src/nidcpower/system_tests/grpc_server_config.json @@ -0,0 +1,9 @@ +{ + "address": "[::1]", + "port": 31760, + "security" : { + "server_cert": "", + "server_key": "", + "root_cert": "" + } + } diff --git a/src/nidcpower/system_tests/test_system_nidcpower.py b/src/nidcpower/system_tests/test_system_nidcpower.py index 6abacd27e..4572a58cb 100644 --- a/src/nidcpower/system_tests/test_system_nidcpower.py +++ b/src/nidcpower/system_tests/test_system_nidcpower.py @@ -1099,7 +1099,9 @@ def test_lcr_compensation_data(self, session): class TestGrpc(SystemTests): @pytest.fixture(scope='class') def grpc_channel(self): - with system_test_utilities.GrpcServerProcess() as proc: + current_directory = os.path.dirname(os.path.abspath(__file__)) + config_file_path = os.path.join(current_directory, 'grpc_server_config,json') + with system_test_utilities.GrpcServerProcess(config_file_path) as proc: channel = grpc.insecure_channel(f"localhost:{proc.server_port}") yield channel diff --git a/src/nidigital/system_tests/grpc_server_config.json b/src/nidigital/system_tests/grpc_server_config.json new file mode 100644 index 000000000..7692c8066 --- /dev/null +++ b/src/nidigital/system_tests/grpc_server_config.json @@ -0,0 +1,9 @@ +{ + "address": "[::1]", + "port": 31761, + "security" : { + "server_cert": "", + "server_key": "", + "root_cert": "" + } + } diff --git a/src/nidigital/system_tests/test_system_nidigital.py b/src/nidigital/system_tests/test_system_nidigital.py index 8e48f7714..854ed2ce1 100644 --- a/src/nidigital/system_tests/test_system_nidigital.py +++ b/src/nidigital/system_tests/test_system_nidigital.py @@ -1350,7 +1350,9 @@ def test_enable_match_fail_combination(self, multi_instrument_session): class TestGrpc(SystemTests): @pytest.fixture(scope='class') def grpc_channel(self): - with system_test_utilities.GrpcServerProcess() as proc: + current_directory = os.path.dirname(os.path.abspath(__file__)) + config_file_path = os.path.join(current_directory, 'grpc_server_config,json') + with system_test_utilities.GrpcServerProcess(config_file_path) as proc: channel = grpc.insecure_channel(f"localhost:{proc.server_port}") yield channel diff --git a/src/nidmm/system_tests/grpc_server_config.json b/src/nidmm/system_tests/grpc_server_config.json new file mode 100644 index 000000000..7e5bedc33 --- /dev/null +++ b/src/nidmm/system_tests/grpc_server_config.json @@ -0,0 +1,9 @@ +{ + "address": "[::1]", + "port": 31762, + "security" : { + "server_cert": "", + "server_key": "", + "root_cert": "" + } + } diff --git a/src/nidmm/system_tests/test_system_nidmm.py b/src/nidmm/system_tests/test_system_nidmm.py index 74d45ab98..5542c93f9 100644 --- a/src/nidmm/system_tests/test_system_nidmm.py +++ b/src/nidmm/system_tests/test_system_nidmm.py @@ -330,7 +330,9 @@ def test_fetch_waveform_into(self, session): class TestGrpc(SystemTests): @pytest.fixture(scope='class') def grpc_channel(self): - with system_test_utilities.GrpcServerProcess() as proc: + current_directory = os.path.dirname(os.path.abspath(__file__)) + config_file_path = os.path.join(current_directory, 'grpc_server_config,json') + with system_test_utilities.GrpcServerProcess(config_file_path) as proc: channel = grpc.insecure_channel(f"localhost:{proc.server_port}") yield channel diff --git a/src/nifgen/system_tests/grpc_server_config.json b/src/nifgen/system_tests/grpc_server_config.json new file mode 100644 index 000000000..0da46cb2a --- /dev/null +++ b/src/nifgen/system_tests/grpc_server_config.json @@ -0,0 +1,9 @@ +{ + "address": "[::1]", + "port": 31763, + "security" : { + "server_cert": "", + "server_key": "", + "root_cert": "" + } + } diff --git a/src/nifgen/system_tests/test_system_nifgen.py b/src/nifgen/system_tests/test_system_nifgen.py index 8c8a1ce22..fcfb6c084 100644 --- a/src/nifgen/system_tests/test_system_nifgen.py +++ b/src/nifgen/system_tests/test_system_nifgen.py @@ -516,7 +516,9 @@ def test_write_named_waveform_numpy_array_int16(self, session): class TestGrpc(SystemTests): @pytest.fixture(scope='class') def grpc_channel(self): - with system_test_utilities.GrpcServerProcess() as proc: + current_directory = os.path.dirname(os.path.abspath(__file__)) + config_file_path = os.path.join(current_directory, 'grpc_server_config,json') + with system_test_utilities.GrpcServerProcess(config_file_path) as proc: channel = grpc.insecure_channel(f"localhost:{proc.server_port}") yield channel diff --git a/src/niscope/system_tests/grpc_server_config.json b/src/niscope/system_tests/grpc_server_config.json new file mode 100644 index 000000000..b7917b385 --- /dev/null +++ b/src/niscope/system_tests/grpc_server_config.json @@ -0,0 +1,9 @@ +{ + "address": "[::1]", + "port": 31764, + "security" : { + "server_cert": "", + "server_key": "", + "root_cert": "" + } + } diff --git a/src/niscope/system_tests/test_system_niscope.py b/src/niscope/system_tests/test_system_niscope.py index 263d5eb42..e2c573a43 100644 --- a/src/niscope/system_tests/test_system_niscope.py +++ b/src/niscope/system_tests/test_system_niscope.py @@ -612,7 +612,9 @@ def test_reset_with_defaults(self, single_instrument_session): class TestGrpc(SystemTests): @pytest.fixture(scope='class') def grpc_channel(self): - with system_test_utilities.GrpcServerProcess() as proc: + current_directory = os.path.dirname(os.path.abspath(__file__)) + config_file_path = os.path.join(current_directory, 'grpc_server_config,json') + with system_test_utilities.GrpcServerProcess(config_file_path) as proc: channel = grpc.insecure_channel(f"localhost:{proc.server_port}") yield channel diff --git a/src/niswitch/system_tests/grpc_server_config.json b/src/niswitch/system_tests/grpc_server_config.json new file mode 100644 index 000000000..69aa29677 --- /dev/null +++ b/src/niswitch/system_tests/grpc_server_config.json @@ -0,0 +1,9 @@ +{ + "address": "[::1]", + "port": 31765, + "security" : { + "server_cert": "", + "server_key": "", + "root_cert": "" + } + } diff --git a/src/niswitch/system_tests/test_system_niswitch.py b/src/niswitch/system_tests/test_system_niswitch.py index 22793b833..8dcb88b73 100644 --- a/src/niswitch/system_tests/test_system_niswitch.py +++ b/src/niswitch/system_tests/test_system_niswitch.py @@ -195,7 +195,9 @@ def session_creation_kwargs(self): class TestGrpc(SystemTests): @pytest.fixture(scope='class') def grpc_channel(self): - with system_test_utilities.GrpcServerProcess() as proc: + current_directory = os.path.dirname(os.path.abspath(__file__)) + config_file_path = os.path.join(current_directory, 'grpc_server_config,json') + with system_test_utilities.GrpcServerProcess(config_file_path) as proc: channel = grpc.insecure_channel(f"localhost:{proc.server_port}") yield channel diff --git a/src/shared/system_test_utilities.py b/src/shared/system_test_utilities.py index 7938e4574..dea3b2d1c 100644 --- a/src/shared/system_test_utilities.py +++ b/src/shared/system_test_utilities.py @@ -8,9 +8,9 @@ class GrpcServerProcess: - def __init__(self): + def __init__(self, config_file_path): server_exe = self._get_grpc_server_exe() - self._proc = subprocess.Popen([str(server_exe)], stdout=subprocess.PIPE) + self._proc = subprocess.Popen([str(server_exe), config_file_path], stdout=subprocess.PIPE) # Read/parse output until we find the port number or the process exits; discard the rest. try: From 6bd7478edc8e9373e30f66f67d6da11327378cd7 Mon Sep 17 00:00:00 2001 From: Saarthak Mohan <--global> Date: Tue, 11 Mar 2025 14:35:05 -0500 Subject: [PATCH 2/2] Change comma to period --- src/nidcpower/system_tests/test_system_nidcpower.py | 2 +- src/nidigital/system_tests/test_system_nidigital.py | 2 +- src/nidmm/system_tests/test_system_nidmm.py | 2 +- src/nifgen/system_tests/test_system_nifgen.py | 2 +- src/niscope/system_tests/test_system_niscope.py | 2 +- src/niswitch/system_tests/test_system_niswitch.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/nidcpower/system_tests/test_system_nidcpower.py b/src/nidcpower/system_tests/test_system_nidcpower.py index 4572a58cb..4b6ce4c61 100644 --- a/src/nidcpower/system_tests/test_system_nidcpower.py +++ b/src/nidcpower/system_tests/test_system_nidcpower.py @@ -1100,7 +1100,7 @@ class TestGrpc(SystemTests): @pytest.fixture(scope='class') def grpc_channel(self): current_directory = os.path.dirname(os.path.abspath(__file__)) - config_file_path = os.path.join(current_directory, 'grpc_server_config,json') + config_file_path = os.path.join(current_directory, 'grpc_server_config.json') with system_test_utilities.GrpcServerProcess(config_file_path) as proc: channel = grpc.insecure_channel(f"localhost:{proc.server_port}") yield channel diff --git a/src/nidigital/system_tests/test_system_nidigital.py b/src/nidigital/system_tests/test_system_nidigital.py index 854ed2ce1..ea477713f 100644 --- a/src/nidigital/system_tests/test_system_nidigital.py +++ b/src/nidigital/system_tests/test_system_nidigital.py @@ -1351,7 +1351,7 @@ class TestGrpc(SystemTests): @pytest.fixture(scope='class') def grpc_channel(self): current_directory = os.path.dirname(os.path.abspath(__file__)) - config_file_path = os.path.join(current_directory, 'grpc_server_config,json') + config_file_path = os.path.join(current_directory, 'grpc_server_config.json') with system_test_utilities.GrpcServerProcess(config_file_path) as proc: channel = grpc.insecure_channel(f"localhost:{proc.server_port}") yield channel diff --git a/src/nidmm/system_tests/test_system_nidmm.py b/src/nidmm/system_tests/test_system_nidmm.py index 5542c93f9..55cdea398 100644 --- a/src/nidmm/system_tests/test_system_nidmm.py +++ b/src/nidmm/system_tests/test_system_nidmm.py @@ -331,7 +331,7 @@ class TestGrpc(SystemTests): @pytest.fixture(scope='class') def grpc_channel(self): current_directory = os.path.dirname(os.path.abspath(__file__)) - config_file_path = os.path.join(current_directory, 'grpc_server_config,json') + config_file_path = os.path.join(current_directory, 'grpc_server_config.json') with system_test_utilities.GrpcServerProcess(config_file_path) as proc: channel = grpc.insecure_channel(f"localhost:{proc.server_port}") yield channel diff --git a/src/nifgen/system_tests/test_system_nifgen.py b/src/nifgen/system_tests/test_system_nifgen.py index fcfb6c084..7f1902860 100644 --- a/src/nifgen/system_tests/test_system_nifgen.py +++ b/src/nifgen/system_tests/test_system_nifgen.py @@ -517,7 +517,7 @@ class TestGrpc(SystemTests): @pytest.fixture(scope='class') def grpc_channel(self): current_directory = os.path.dirname(os.path.abspath(__file__)) - config_file_path = os.path.join(current_directory, 'grpc_server_config,json') + config_file_path = os.path.join(current_directory, 'grpc_server_config.json') with system_test_utilities.GrpcServerProcess(config_file_path) as proc: channel = grpc.insecure_channel(f"localhost:{proc.server_port}") yield channel diff --git a/src/niscope/system_tests/test_system_niscope.py b/src/niscope/system_tests/test_system_niscope.py index e2c573a43..60702465e 100644 --- a/src/niscope/system_tests/test_system_niscope.py +++ b/src/niscope/system_tests/test_system_niscope.py @@ -613,7 +613,7 @@ class TestGrpc(SystemTests): @pytest.fixture(scope='class') def grpc_channel(self): current_directory = os.path.dirname(os.path.abspath(__file__)) - config_file_path = os.path.join(current_directory, 'grpc_server_config,json') + config_file_path = os.path.join(current_directory, 'grpc_server_config.json') with system_test_utilities.GrpcServerProcess(config_file_path) as proc: channel = grpc.insecure_channel(f"localhost:{proc.server_port}") yield channel diff --git a/src/niswitch/system_tests/test_system_niswitch.py b/src/niswitch/system_tests/test_system_niswitch.py index 8dcb88b73..4bcfa0aad 100644 --- a/src/niswitch/system_tests/test_system_niswitch.py +++ b/src/niswitch/system_tests/test_system_niswitch.py @@ -196,7 +196,7 @@ class TestGrpc(SystemTests): @pytest.fixture(scope='class') def grpc_channel(self): current_directory = os.path.dirname(os.path.abspath(__file__)) - config_file_path = os.path.join(current_directory, 'grpc_server_config,json') + config_file_path = os.path.join(current_directory, 'grpc_server_config.json') with system_test_utilities.GrpcServerProcess(config_file_path) as proc: channel = grpc.insecure_channel(f"localhost:{proc.server_port}") yield channel