def test_can_select_by_label(cl, client, has_conf): has_conf.return_value = False result = MagicMock() result.items = [MagicMock()] v1 = MagicMock() v1.list_namespaced_service.return_value = result client.CoreV1Api.return_value = v1 label_selector = "app=my-super-app" service_is_initialized("mysvc", label_selector=label_selector) v1.list_namespaced_service.assert_called_with( "default", label_selector=label_selector )
def service_endpoint_is_initialized(name: str, ns: str = "default", label_selector: str = "name in ({name})", secrets: Secrets = None): """ !!!DEPRECATED!!! """ _log_deprecated("service_endpoint_is_initialized", "service_is_initialized") return service_is_initialized(name, ns, label_selector, secrets)
def test_expecting_service_should_be_initialized(cl, client, has_conf): has_conf.return_value = False service = MagicMock() result = MagicMock() result.items = [service] v1 = MagicMock() v1.list_namespaced_service.return_value = result client.CoreV1Api.return_value = v1 assert service_is_initialized("mysvc") is True
def test_expecting_service_should_be_initialized(cl, client, has_conf): has_conf.return_value = False service = MagicMock() result = MagicMock() result.items = [service] v1 = MagicMock() v1.list_namespaced_service.return_value = result client.CoreV1Api.return_value = v1 assert service_is_initialized("mysvc") is True v1.list_namespaced_service.assert_called_with( "default", field_selector="metadata.name=mysvc")