def test_deployment_is_not_fully_available_when_it_should( cl, client, watch, has_conf): has_conf.return_value = False deployment = MagicMock() deployment.spec.replicas = 2 deployment.status.ready_replicas = 1 watcher = MagicMock() watcher.stream = MagicMock() watcher.stream.side_effect = urllib3.exceptions.ReadTimeoutError( None, None, None) watch.Watch.return_value = watcher with pytest.raises(ActivityFailed) as excinfo: deployment_fully_available("mysvc") assert "deployment 'mysvc' failed to recover within" in str(excinfo)
def test_deployment_is_fully_available(cl, client, watch, has_conf): has_conf.return_value = False deployment = MagicMock() deployment.spec.replicas = 2 deployment.status.ready_replicas = 2 watcher = MagicMock() watcher.stream = MagicMock() watcher.stream.side_effect = [[{"object": deployment, "type": "ADDED"}]] watch.Watch.return_value = watcher assert deployment_fully_available("mysvc") is True
def deployment_is_fully_available( name: str, ns: str = "default", label_selector: str = None, timeout: int = 30, secrets: Secrets = None, ): """ !!!DEPRECATED!!! """ _log_deprecated("deployment_is_fully_available", "deployment_fully_available") return deployment_fully_available(name, ns, label_selector, timeout, secrets)