diff --git a/SAS/TMSS/test/test_utils.py b/SAS/TMSS/test/test_utils.py index 1029deb3474ce830e83f3d8d0a26f07c9bf3620f..779d34703fab5b2f11e41a47eeb9e8b65304b980 100644 --- a/SAS/TMSS/test/test_utils.py +++ b/SAS/TMSS/test/test_utils.py @@ -272,7 +272,8 @@ class TMSSTestEnvironment: populate_schemas:bool=False, populate_test_data:bool=False, start_ra_test_environment: bool=False, start_postgres_listener: bool=False, start_subtask_scheduler: bool=False, start_dynamic_scheduler: bool=False, - start_pipeline_control: bool=False, enable_viewflow: bool=False): + start_pipeline_control: bool=False, start_ingest_tmss_adapter: bool=False, + enable_viewflow: bool=False): self._exchange = exchange self._broker = broker self._populate_schemas = populate_schemas @@ -302,6 +303,9 @@ class TMSSTestEnvironment: self._start_pipeline_control = start_pipeline_control self.pipeline_control = None + self._start_ingest_tmss_adapter = start_ingest_tmss_adapter + self.ingest_tmss_adapter = None + if enable_viewflow: os.environ['TMSS_ENABLE_VIEWFLOW'] = 'True' @@ -366,6 +370,11 @@ class TMSSTestEnvironment: self.pipeline_control = PipelineControlTMSS(exchange=self._exchange, broker=self._broker) self.pipeline_control.start_listening() + if self._start_ingest_tmss_adapter: + from lofar.lta.ingest.server.ingesttmssadapter import IngestTMSSAdapter + self.ingest_tmss_adapter = IngestTMSSAdapter(tmss_creds=self.client_credentials.dbcreds, exchange=self._exchange, broker=self._broker) + self.ingest_tmss_adapter.open() + if self._populate_schemas or self._populate_test_data: self.populate_schemas() @@ -390,6 +399,10 @@ class TMSSTestEnvironment: self.pipeline_control.stop_listening() self.pipeline_control = None + if self.ingest_tmss_adapter is not None: + self.ingest_tmss_adapter.close() + self.ingest_tmss_adapter = None + if self.ra_test_environment is not None: self.ra_test_environment.stop() self.ra_test_environment = None @@ -488,7 +501,8 @@ def main_test_environment(): populate_schemas=options.schemas, populate_test_data=options.data, start_ra_test_environment=options.services, start_postgres_listener=options.services, start_subtask_scheduler=options.services, start_dynamic_scheduler=options.services, - start_pipeline_control=options.services, enable_viewflow=options.viewflow) as tmss_test_env: + start_pipeline_control=options.services, start_ingest_tmss_adapter=options.services, + enable_viewflow=options.viewflow) as tmss_test_env: # print some nice info for the user to use the test servers... # use print instead of log for clean lines.