Skip to content

Commit e2935a5

Browse files
Merge pull request #730 from element-hq/gaelg/curl-wait-and-raise
run pod with args: properly raise an error if its not ready in time
2 parents b1b6b88 + f2e8100 commit e2935a5

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

newsfragments/730.internal.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CI: Raise an error if the pod is not ready when we want to run it.

tests/integration/lib/helpers.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,24 +148,24 @@ async def run_pod_with_args(kube_client: AsyncClient, generated_data, image_name
148148
start_time = time.time()
149149
now = time.time()
150150
completed = False
151-
while start_time + 30 > now and not completed:
151+
while start_time + 60 > now and not completed:
152152
found_pod = await kube_client.get(Pod, name=pod.metadata.name, namespace=pod.metadata.namespace)
153153
if (
154154
found_pod.status
155155
and found_pod.status.containerStatuses
156-
and found_pod.status.containerStatuses[0].lastState
157-
and found_pod.status.containerStatuses[0].lastState.terminated
158-
and found_pod.status.containerStatuses[0].lastState.terminated.reason == "Completed"
156+
and found_pod.status.containerStatuses[0].state
157+
and found_pod.status.containerStatuses[0].state.terminated
158+
and found_pod.status.containerStatuses[0].state.terminated.reason == "Completed"
159159
):
160160
completed = True
161161
else:
162162
now = time.time()
163163
await asyncio.sleep(1)
164164
else:
165-
if start_time + 30 > now:
165+
if start_time + 60 <= now:
166166
raise RuntimeError(
167167
f"Pod {pod.metadata.name} did not start in time "
168-
f"(failed after {time.time() - now} seconds), "
168+
f"(failed after {now - start_time} seconds), "
169169
f"pod status: {found_pod.status}"
170170
)
171171

0 commit comments

Comments
 (0)