April 2018
Intermediate to advanced
374 pages
8h 35m
English
Following the deployment, we expect the deployment and services to all become active, but this does not happen instantaneously. Depending on your environment, it may happen quite quickly, or fairly slowly. The bane of integration tests is not being able to know when something has completed, and working around the issue with an invocation of sleep() to wait a little longer. In this example, we explicitly check the status rather than just waiting an arbitrary amount of time and hoping the system is ready to go:
@pytest.mark.dependency(depends=["test_deployment_ready"])def test_pods_running(kube_v1_client): TOTAL_TIMEOUT_SECONDS = 300 DELAY_BETWEEN_REQUESTS_SECONDS = 5 now = time.time() while (time.time() < now+TOTAL_TIMEOUT_SECONDS): ...
Read now
Unlock full access