Commit bb72ab66 authored by Wout De Nolf's avatar Wout De Nolf
Browse files

deprecation warning for the ICAT tango servers

parent 1daf16ca
Pipeline #50504 passed with stages
in 108 minutes and 46 seconds
......@@ -854,6 +854,9 @@ class ESRFScanSaving(BasicScanSaving):
try:
self._icat_client = icat_client_from_config()
except Exception:
logtools.user_warning(
"The `icat_servers` beacon configuration is missing. Falling back to the deprecated ICAT tango servers."
)
self._icat_client = IcatTangoProxy(self.beamline, self.session)
return self._icat_client
......
......@@ -1170,17 +1170,13 @@ def icat_backend(stomp_server, activemq_rest_server, icat_logbook_server):
elogbook_url = f"http://localhost:{port}"
host, port = activemq_rest_server
metadata_queue_monitor_port = port
yield {
icat_servers = {
"metadata_urls": metadata_urls,
"elogbook_url": elogbook_url,
"metadata_queue_monitor_port": metadata_queue_monitor_port,
}
@pytest.fixture
def icat_config_backend(icat_backend):
config = static.get_config()
config.root["icat_servers"] = icat_backend
config.root["icat_servers"] = icat_servers
try:
yield
finally:
......
......@@ -56,7 +56,7 @@ def _esrf_data_policy(session):
@pytest.fixture
def esrf_data_policy(session, icat_config_backend):
def esrf_data_policy(session, icat_backend):
yield from _esrf_data_policy(session)
......@@ -75,7 +75,7 @@ def session2(beacon, scan_tmpdir):
@pytest.fixture
def esrf_data_policy2(session2, icat_config_backend):
def esrf_data_policy2(session2, icat_backend):
yield from _esrf_data_policy(session2)
......
......@@ -47,7 +47,7 @@ def logging_session_without_elogserver(beacon_with_logging_esrf, log_directory):
@pytest.fixture
def logging_session_with_elogserver(
beacon_with_logging_esrf, metaexp_with_backend, metamgr_with_backend, log_directory
beacon_with_logging_esrf, icat_backend, log_directory
):
logfile = os.path.join(log_directory, "test_logging_session.log")
with open(logfile, "w"):
......@@ -63,14 +63,19 @@ def check_scripts_finished(session):
assert session.env_dict.get("scriptfinished")
def check_user_logging(capsys, elog_offline=False):
def check_user_logging(capsys, elog_offline=False, data_policy=True):
captured = capsys.readouterr().err.split("\n")
captured = [s for s in captured if s]
assert len(captured) == 6 + elog_offline, captured
nexpected = 6 + elog_offline + (elog_offline and data_policy)
assert len(captured) == nexpected, captured
i = 0
expected = "ERROR: LogInitController: user error"
assert captured[i] == expected
i += 1
if data_policy and elog_offline:
expected = "WARNING: The `icat_servers` beacon configuration is missing. Falling back to the deprecated ICAT tango servers."
assert captured[i] == expected
i += 1
if elog_offline:
expected = "Electronic logbook failed"
assert expected in captured[i]
......@@ -142,7 +147,7 @@ def test_setup_logging_no_data_policy(
):
logfile = os.path.join(log_directory, logging_session.name + ".log")
check_scripts_finished(logging_session)
check_user_logging(capsys)
check_user_logging(capsys, data_policy=False)
check_beacon_logging(caplog, logfile)
assert len(icat_logbook_subscriber) == 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment