diff --git a/states/_modules/cfutils.py b/states/_modules/cfutils.py index 2f8658e..29c8833 100644 --- a/states/_modules/cfutils.py +++ b/states/_modules/cfutils.py @@ -85,4 +85,6 @@ def get_colo_names(timeout=10: int, backup=True: bool) -> list[str]: return [] if backup: - return __salt__["provision_api.get_names"](type="colo", timeout=timeout) \ No newline at end of file + return __salt__["provision_api.get_names"](type="colo", timeout=timeout) + else: + return [] \ No newline at end of file diff --git a/tests/pytests/unit/_modules/test_cfutils.py b/tests/pytests/unit/_modules/test_cfutils.py index 1c74952..25a2d23 100644 --- a/tests/pytests/unit/_modules/test_cfutils.py +++ b/tests/pytests/unit/_modules/test_cfutils.py @@ -122,6 +122,11 @@ def test_get_colo_names_timeout_from_zinc_falls_back_to_provision_api() -> None: with mock_server("provision_api", "get_names", 200, ["provision_api_colo"]): assert cfutils.get_colo_names() == ["provision_api_colo"] +# Slow test due to the wait for a Zinc timeout (10s) +@pytest.mark.slow +def test_get_colo_names_timeout_from_zinc_with_no_backup() -> None: + assert cfutils.get_colo_names(backup = False) == [] + # Really slow test due to wait for both Zinc and Provision API timeout (20s) @pytest.mark.slow def test_get_colo_names_returns_error_on_backup_failure() -> None: