Skip to content

test: increase pod creation timeout in migration test to fix flake#1013

Merged
kubernetes-prow[bot] merged 1 commit into
kubernetes-sigs:mainfrom
janetkuo:fix/issue-1011
Jun 23, 2026
Merged

test: increase pod creation timeout in migration test to fix flake#1013
kubernetes-prow[bot] merged 1 commit into
kubernetes-sigs:mainfrom
janetkuo:fix/issue-1011

Conversation

@janetkuo

@janetkuo janetkuo commented Jun 22, 2026

Copy link
Copy Markdown
Member

What this PR does / why we need it:

This PR increases the polling timeout for initial Pod creation in dev/tools/test-migration.py from 20 seconds to 60 seconds to resolve flaky E2E migration test failures in Prow CI.

In Prow CI environments, 20 seconds is frequently too aggressive for a freshly started v0.4.6 controller manager to complete informer cache synchronization, observe the newly seeded Sandbox CR, execute the reconciler, and have the apiserver create the underlying Pod.

Which issue(s) this PR is related to:

Fixes #1011

Release Note

NONE

Summary by CodeRabbit

  • Tests
    • Improved migration/upgrade test stability by extending the wait period for the upgrade sandbox Pod.
    • Updated polling behavior to reduce load (longer sleep) and added periodic progress logging.
    • If the Pod still doesn’t appear, the test now outputs extra diagnostics before proceeding to readiness checks.
Copilot AI review requested due to automatic review settings June 22, 2026 23:46
@netlify

netlify Bot commented Jun 22, 2026

Copy link
Copy Markdown

Deploy Preview for agent-sandbox canceled.

Name Link
🔨 Latest commit ad60141
🔍 Latest deploy log https://app.netlify.com/projects/agent-sandbox/deploys/6a39cec53285c10008db125b
@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: janetkuo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot requested review from igooch and justinsb June 22, 2026 23:46
@kubernetes-prow kubernetes-prow Bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 22, 2026
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1eaece30-b9d3-4881-acb3-bf594584406f

📥 Commits

Reviewing files that changed from the base of the PR and between 4d0c8e5 and ad60141.

📒 Files selected for processing (1)
  • dev/tools/test-migration.py

📝 Walkthrough

Walkthrough

In dev/tools/test-migration.py, the polling loop inside create_v1alpha1_objects that waits for the upgrade-sandbox-running Pod to appear is extended from 20 to 60 iterations with increased sleep duration, periodic progress logging every 5 attempts, and diagnostic kubectl output on timeout.

Changes

Pod polling reliability improvement

Layer / File(s) Summary
Extend Pod polling timeout with diagnostics and logging
dev/tools/test-migration.py
The polling loop checking for the upgrade-sandbox-running Pod is increased from 20 to 60 iterations with 2-second delays (instead of 1-second), progress logging is added every 5 attempts, and on timeout the test prints diagnostic information (kubectl get/describe and controller logs) to stderr before the readiness assertion fails.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A bunny tends the garden test,
The Pod was slow, but doing its best.
We doubled the waits and added some clues,
When silence falls, we debug the news.
🐇 Patience and logs make tests more kind! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: increasing a pod creation timeout in the migration test to fix flakiness.
Description check ✅ Passed The description covers all required sections from the template with clear explanations of why the change is needed and links to the related issue.
Linked Issues check ✅ Passed The PR directly addresses issue #1011 by increasing the polling timeout from 20 to 60 seconds, which resolves the Pod creation timeout assertion failure in Prow CI environments.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the flaky timeout issue in the migration test; no unrelated modifications are present in the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces flakiness in the Prow migration/upgrade test by increasing the polling timeout for the initial upgrade-sandbox-running Pod creation in dev/tools/test-migration.py, accommodating slower controller startup/informer sync in CI.

Changes:

  • Increase the Pod existence polling loop from 20 seconds to 60 seconds before failing the migration test.
@janetkuo janetkuo added this to the Beta milestone Jun 22, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
dev/tools/test-migration.py (1)

308-308: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider renaming unused loop variable to _i.

The loop variable i is not used within the loop body. By convention, prefix it with an underscore to signal that it's intentionally unused.

♻️ Proposed fix
-    for i in range(60):
+    for _i in range(60):
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@dev/tools/test-migration.py` at line 308, The loop variable `i` in the for
loop is not used within the loop body. Rename the loop variable from `i` to `_i`
to follow Python convention and signal that this variable is intentionally
unused. This improves code readability and makes the intent clear to other
developers.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@dev/tools/test-migration.py`:
- Line 308: The loop variable `i` in the for loop is not used within the loop
body. Rename the loop variable from `i` to `_i` to follow Python convention and
signal that this variable is intentionally unused. This improves code
readability and makes the intent clear to other developers.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ed4d155c-3605-4068-ab83-b01708766bdb

📥 Commits

Reviewing files that changed from the base of the PR and between 2207443 and 4d0c8e5.

📒 Files selected for processing (1)
  • dev/tools/test-migration.py
Comment thread dev/tools/test-migration.py Outdated
@kubernetes-prow kubernetes-prow Bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 23, 2026
@shrutiyam-glitch

Copy link
Copy Markdown
Contributor

/lgtm

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 23, 2026
@kubernetes-prow kubernetes-prow Bot merged commit 262aa41 into kubernetes-sigs:main Jun 23, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Agent Sandbox Jun 23, 2026
print("Waiting for upgrade-sandbox-running Pod to be created...")
pod_exists = False
for i in range(20):
for i in range(60):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's like a magic number

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

4 participants