def test_logs_check_for_pods_readiness_max_retries_reached(process_helpers, sleep_mock): run_id = str(uuid.uuid4()).split("-") filter_tag = "-".join(["app", run_id[0], run_id[1]]) process_helpers.return_value.stdout.read.return_value = "\n".join(["random-pod1", "random-pod2"]) with catch_stdout() as caught_output: found = check_for_pods_readiness(namespace='namespace', filter_tag=filter_tag, retries=5) output = caught_output.getvalue() assert found == False assert "Max retries Reached." in output
def test_check_for_pods_readiness_no_pods(process_helpers, sleep_mock): run_id = str(uuid.uuid4()).split("-") filter_tag = "-".join(["app", run_id[0], run_id[1]]) process_helpers.return_value.stdout.read.return_value = '' with catch_stdout() as caught_output: found = check_for_pods_readiness(namespace='namespace', filter_tag=filter_tag, retries=1) output = caught_output.getvalue() assert not found assert "Retrying " in output
def test_logs_check_for_pods_readiness_max_retries_when_status_is_not_running(process_helpers, sleep_mock): run_id = str(uuid.uuid4()).split("-") filter_tag = "-".join(["app", run_id[0], run_id[1]]) process_helpers.return_value.stdout.read.return_value = "\n".join([ filter_tag+"-ps-"+run_id[3]+" 1/1 ContainerCreating 0 16d", filter_tag+"-worker1-"+run_id[3]+" 1/1 ContainerCreating 0 16d", filter_tag+"-worker2-"+run_id[3]+" 1/1 ContainerCreating 0 16d"]) with catch_stdout() as caught_output: running = check_for_pods_readiness(namespace='namespace', filter_tag=filter_tag, retries=4) output = caught_output.getvalue() assert running == False assert "Max retries Reached." in output
def test_logs_check_for_pods_readiness(process_helpers, sleep_mock): run_id = str(uuid.uuid4()).split("-") filter_tag = "-".join(["app", run_id[0], run_id[1]]) process_helpers.return_value.stdout.read.return_value = "\n".join(["random-pod1", "random-pod2", filter_tag+"-ps-"+run_id[3]+" 1/1 Running 0 16d", filter_tag+"-worker1-"+run_id[3]+" 1/1 Running 0 16d", filter_tag+"-worker2-"+run_id[3]+" 1/1 Running 0 16d"]) with catch_stdout() as caught_output: found = check_for_pods_readiness(namespace='namespace', filter_tag=filter_tag, retries=5) output = caught_output.getvalue() assert found == True assert "Checking for pod(s) readiness" in output