Skip to content

e2e: use wait.PollUntilContextTimeout in suite and ssh agent helper - #1515

Merged
skevetter merged 1 commit into
mainfrom
refactor/e2e-poll-wait-helpers
Oct 17, 2026
Merged

skevetter merged 1 commit into
mainfrom
refactor/e2e-poll-wait-helpers

Conversation

@skevetter

@skevetter skevetter commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Why

Two hand-rolled time.Sleep poll loops in the e2e suite are replaced with wait.PollUntilContextTimeout from k8s.io/apimachinery/pkg/util/wait, the same helper already used by waitForRegistryReady in e2e/tests/snapshot/helper.go. Shared helper, same timeout and interval as before, no sleep loops left at these sites. Behaviour-preserving.

Changes

  • e2e/framework/ssh_agent.go waitForAgentSocket: polls os.Stat(sockPath) every 25ms for up to 2s (immediate first check). Timeout error keeps its wording and now wraps the poll error with %w.
  • e2e/e2e_suite_test.go TestRunE2ETests, non-linux branch: polls DEVSY_AGENT_URL every 1s for up to 30s (immediate first check). t.Fatal message unchanged.
  • e2e/framework/ssh_agent_test.go (new): two unit tests for waitForAgentSocket. Socket appears shortly after the call returns nil; socket never appears returns an error. No assertions on sleep durations or log text.

CI jobs exercised

  • ssh-agent-forward (e2e/tests/ssh/agent_forward.go, calls StartMockSSHAgent): runs on ubuntu-latest on this PR.
  • up-provider-kubernetes (e2e/tests/up/provider_kubernetes_ssh_agent.go, calls StartMockSSHAgent): runs on ubuntu-latest on this PR.
  • Non-linux suite branch: no ubuntu CI row exercises it. Exercised locally on darwin: the root ./e2e/ ginkgo dry-run ran through the branch and enumerated 503 specs.

Local verification

  • go build ./e2e/...: pass
  • go vet ./e2e/framework/...: pass
  • go test ./e2e/framework/ -run 'TestWaitForAgentSocket|Ssh' -count=1: pass (both new tests)
  • ginkgo --dry-run ./e2e/: 503 of 503 specs, pass (via go run github.com/onsi/ginkgo/v2/ginkgo)
  • task cli:format: pass, no changes
  • task cli:lint:ci: 0 issues
  • gofmt -l e2e/: clean

Auto-merge

eligible: e2e/framework and e2e/e2e_suite_test.go only, no workflow files

Summary by CodeRabbit

  • Tests
    • Improved end-to-end test readiness checks by waiting for required services to become available, with a bounded timeout.
    • Added coverage for both delayed service availability and cases where a service does not become available.

@skevetter skevetter added the ci-refactor CI/e2e refactor label Oct 17, 2026
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ce3e741a-0ac2-4157-bb23-d5fe37f8a7f9
📥 Commits

Reviewing files that changed from the base of the PR and between 234b5f2 and 0639ceb.

📒 Files selected for processing: 3
  • e2e/e2e_suite_test.go
  • e2e/framework/ssh_agent.go
  • e2e/framework/ssh_agent_test.go

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

📝 Walkthrough

The E2E suite and SSH agent framework replace manual wait loops with Kubernetes context-aware polling. New tests cover successful and unsuccessful SSH agent socket waits.

Changes: E2E polling

Layer / File(s) Summary
Agent URL polling
e2e/e2e_suite_test.go
The suite checks DEVSY_AGENT_URL immediately, then polls at one-second intervals for up to 30 seconds. It fails if polling returns an error.
Agent socket polling and tests
e2e/framework/ssh_agent.go, e2e/framework/ssh_agent_test.go
waitForAgentSocket checks immediately, then polls every 25 ms for up to two seconds. Polling errors are wrapped. Tests cover a socket that appears after a delay and a socket that remains absent.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Suggested reviewers: 89luca89

Merge Risk: ⚪ Minimal · up to 0639c

The E2E readiness waits remain bounded and retain their stated success and failure behavior. No actionable merge-blocking risk is identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: replacing polling loops in the E2E suite and SSH agent helper with wait.PollUntilContextTimeout.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@netlify

netlify Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 0639ceb
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6ad2c25e1060b4c67bef2aaa

@netlify

netlify Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit 0639ceb
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6ad2c25ec497a8bcf924e9d5

@skevetter
skevetter marked this pull request as ready for review October 17, 2026 01:18
@mergify

mergify Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@skevetter
skevetter merged commit e242b32 into main Oct 17, 2026
111 checks passed
@skevetter
skevetter deleted the refactor/e2e-poll-wait-helpers branch October 17, 2026 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-refactor CI/e2e refactor size/m

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant