Skip to content

Commit

Permalink
Fix job test (#739)
Browse files Browse the repository at this point in the history
  • Loading branch information
bstadlbauer authored Jun 23, 2023
1 parent 1e49482 commit 97dfbbc
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions dask_kubernetes/operator/controller/tests/test_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,6 @@ def _assert_final_job_status(job, job_status, expected_status):


@pytest.mark.asyncio
@pytest.mark.skip(reason="Flaky in CI")
async def test_job(k8s_cluster, kopf_runner, gen_job):
with kopf_runner as runner:
async with gen_job("simplejob.yaml") as (job, ns):
Expand Down Expand Up @@ -493,11 +492,11 @@ async def test_job(k8s_cluster, kopf_runner, gen_job):
_assert_job_status_cluster_created(job, job_status)

# Assert job pod is created
while job not in k8s_cluster.kubectl("get", "po"):
while job not in k8s_cluster.kubectl("get", "po", "-n", ns):
await asyncio.sleep(0.1)

# Assert that pod started Running
while "Running" not in k8s_cluster.kubectl("get", "po"):
while "Running" not in k8s_cluster.kubectl("get", "po", "-n", ns):
await asyncio.sleep(0.1)

await asyncio.sleep(5) # Wait for a short time, to avoid race condition
Expand All @@ -515,7 +514,7 @@ async def test_job(k8s_cluster, kopf_runner, gen_job):
"jsonpath='{.items[0].metadata.annotations}'",
)[1:-1]
)
_EXPECTED_ANNOTATIONS.items() <= job_annotations.items()
assert _EXPECTED_ANNOTATIONS.items() <= job_annotations.items()

# Assert job pod runs to completion (will fail if doesn't connect to cluster)
while "Completed" not in k8s_cluster.kubectl(
Expand Down

0 comments on commit 97dfbbc

Please sign in to comment.