test fixes

This commit is contained in:
Florian Apolloner
2025-09-15 20:02:31 +02:00
parent 04cc58a5c7
commit a2c9bb12e5
3 changed files with 9 additions and 6 deletions
+2 -3
View File
@@ -104,7 +104,7 @@ def get_configured_data_source(config, restore_dump):
hook_data_source.get('name'),
hook_data_source.get('hostname', 'localhost'),
hook_data_source.get('port'),
hook_data_source.get('label'),
hook_data_source.get('label') or hook_data_source.get('container') or UNSPECIFIED,
),
restore_dump,
default_port,
@@ -181,7 +181,7 @@ def restore_single_dump(
data_source['name'],
data_source.get('hostname'),
data_source.get('port'),
data_source.get('label'),
data_source.get('label') or data_source.get('container') or UNSPECIFIED,
),
)
@@ -568,7 +568,6 @@ def run_restore(
config,
restore_dump,
)
# For a dump that wasn't found via an exact match in the configuration, try to fallback
# to an "all" data source.
if not found_data_source:
+4 -2
View File
@@ -61,7 +61,7 @@ def get_ip_from_container(container):
)
except subprocess.CalledProcessError as error:
last_error = error
logger.debug(f"Couldn't find container '{container}' with engine '{engine}'")
logger.debug(f"Could not find container '{container}' with engine '{engine}'")
continue # Container does not exist
network_data = json.loads(output.strip())
@@ -77,4 +77,6 @@ def get_ip_from_container(container):
if last_error:
raise last_error
return None
raise ValueError(
f"Could not determine ip address for container '{container}'; running in host mode or userspace networking?"
)
+3 -1
View File
@@ -88,4 +88,6 @@ def test_get_container_ip_container_no_network():
flexmock(utils).should_receive('execute_command_and_capture_output').and_return('{}')
assert utils.get_ip_from_container('yolo') is None
with pytest.raises(ValueError) as exc_info:
utils.get_ip_from_container('yolo')
assert 'Could not determine ip address for container' in str(exc_info.value)