Skip to content

Commit cd63b0e

Browse files
committed
Let some system tests talk to deployed server
1 parent de81d49 commit cd63b0e

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ addopts = """
7575
"""
7676
markers = """
7777
requires_local_server: mark a test which requires locally hosting the config server
78+
requires_deployed_server: mark a test which requires talking to the deployed config server
7879
use_threading: mark a test which will kickoff the background thread in WhitelistFetcher
7980
"""
8081

tests/system_tests/test_client.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
)
2121

2222
SERVER_ADDRESS = "http://0.0.0.0:8555"
23+
DEPLOYED_SERVER_ADDRESS = "https://daq-config.diamond.ac.uk"
2324

2425
# Docs for running these system tests will be added in https://github.com/DiamondLightSource/daq-config-server/issues/68
2526

@@ -29,6 +30,11 @@ def server():
2930
return ConfigServer(SERVER_ADDRESS)
3031

3132

33+
@pytest.fixture
34+
def deployed_server():
35+
return ConfigServer(DEPLOYED_SERVER_ADDRESS)
36+
37+
3238
@pytest.mark.requires_local_server
3339
def test_read_unformatted_file_as_plain_text(server: ConfigServer):
3440
with open(TestDataPaths.TEST_BEAMLINE_PARAMETERS_PATH) as f:
@@ -144,23 +150,29 @@ def test_request_for_file_with_converter_with_wrong_pydantic_model_errors(
144150
server.get_file_contents(ServerFilePaths.GOOD_LUT, DisplayConfig)
145151

146152

147-
@pytest.mark.requires_local_server
148-
def test_all_files_in_file_converter_map_can_be_converted_to_dict(server: ConfigServer):
153+
@pytest.mark.requires_deployed_server
154+
def test_all_files_in_file_converter_map_can_be_converted_to_dict(
155+
deployed_server: ConfigServer,
156+
):
149157
for filename in file_converter_map.FILE_TO_CONVERTER_MAP.keys():
150-
result = server.get_file_contents(filename, dict)
158+
if filename.startswith("/tests/test_data/"):
159+
continue
160+
result = deployed_server.get_file_contents(filename, dict)
151161
assert isinstance(result, dict)
152162

153163

154-
@pytest.mark.requires_local_server
164+
@pytest.mark.requires_deployed_server
155165
def test_all_files_in_file_converter_map_can_be_converted_to_target_type(
156-
server: ConfigServer,
166+
deployed_server: ConfigServer,
157167
):
158168
with patch(
159169
"daq_config_server.converters._file_converter_map.xmltodict.parse.__annotations__",
160170
{"return": dict}, # Force a return type for xmltodict.parse()
161171
):
162172
for filename, converter in file_converter_map.FILE_TO_CONVERTER_MAP.items():
173+
if filename.startswith("/tests/test_data/"):
174+
continue
163175
return_type = get_type_hints(converter)["return"]
164176
assert return_type is dict or issubclass(return_type, ConfigModel)
165-
result = server.get_file_contents(filename, return_type)
177+
result = deployed_server.get_file_contents(filename, return_type)
166178
assert isinstance(result, return_type)

0 commit comments

Comments
 (0)