From b47b86aad1756e0d6865ed5a45b06cb5594f206f Mon Sep 17 00:00:00 2001 From: gifrerenom <lluis.gifre@cttc.es> Date: Wed, 25 Jan 2023 18:09:19 +0000 Subject: [PATCH] Monitoring component: - corrected MockContext in unitary test --- src/monitoring/tests/test_unitary.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/monitoring/tests/test_unitary.py b/src/monitoring/tests/test_unitary.py index 60d15ef9d..28de8ca65 100644 --- a/src/monitoring/tests/test_unitary.py +++ b/src/monitoring/tests/test_unitary.py @@ -61,6 +61,8 @@ from device.service.drivers import DRIVERS # pylint: disable=wrong-import-posit LOCAL_HOST = '127.0.0.1' MOCKSERVICE_PORT = 10000 +os.environ[get_env_var_name(ServiceNameEnum.CONTEXT, ENVVAR_SUFIX_SERVICE_HOST )] = str(LOCAL_HOST) +os.environ[get_env_var_name(ServiceNameEnum.CONTEXT, ENVVAR_SUFIX_SERVICE_PORT_GRPC)] = str(MOCKSERVICE_PORT) DEVICE_SERVICE_PORT = MOCKSERVICE_PORT + get_service_port_grpc(ServiceNameEnum.DEVICE) # avoid privileged ports os.environ[get_env_var_name(ServiceNameEnum.DEVICE, ENVVAR_SUFIX_SERVICE_HOST )] = str(LOCAL_HOST) @@ -88,14 +90,9 @@ class MockContextService(GenericGrpcService): self.context_servicer = MockServicerImpl_Context() add_ContextServiceServicer_to_server(self.context_servicer, self.server) - def configure_env_vars(self): - os.environ[get_env_var_name(ServiceNameEnum.CONTEXT, ENVVAR_SUFIX_SERVICE_HOST )] = str(self.bind_address) - os.environ[get_env_var_name(ServiceNameEnum.CONTEXT, ENVVAR_SUFIX_SERVICE_PORT_GRPC)] = str(self.bind_port) - @pytest.fixture(scope='session') def context_service(): _service = MockContextService(MOCKSERVICE_PORT) - _service.configure_env_vars() _service.start() yield _service _service.stop() -- GitLab