Skip to content

refactor(e2e): share kubectl fixture runner in up tests - #1489

Merged
skevetter merged 1 commit into
mainfrom
refactor/e2e-dedupe-kubectl-fixture-runners
Oct 15, 2026
Merged

skevetter merged 1 commit into
mainfrom
refactor/e2e-dedupe-kubectl-fixture-runners

Conversation

@skevetter

@skevetter skevetter commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What

Replace per-file copies of the kubectl/ssh fixture command runner and workspace pod discovery in e2e/tests/up with one shared set in fixture_command.go:

  • runFixtureCommand(ctx, timeout, env, argv...): bounded exec, group cancellation, WaitDelay, env append.
  • fixtureCommand(...): same runner, fails the spec on error.
  • fixtureWorkspacePod(ctx, namespace, selector): Eventually-based single-ready-pod lookup.

Removed: kindSSHCommand, runKindSSHCommand, kindSSHWorkspacePod (ssh agent file) and dockerlessPathKubectl, runDockerlessPathKubectl, dockerlessPathWorkspacePod (dockerless file). Call sites now pass the program name as argv[0].

Why

Two near-identical runner and pod helper copies drifted in shape only; one shared helper keeps timeouts and diagnostics in one place.

Behaviour

  • Timeouts kept per call site: dockerless kubectl time.Minute, kind SSH 2*time.Minute, pod discovery 10*time.Second (the same clip as the old pollCtx).
  • Env: dockerless passes nil, which equals the default os.Environ().
  • Message change: both wrappers now assert fixture command %v: %s. The dockerless message was kubectl %v: %s; the kind message was private SSH fixture command .... Neutral wording is used because kind call sites run docker, git, ssh, cp and kubectl.
  • Pod helper: dockerless callers gain the selector message and a GinkgoWriter line; no assertion removed.
  • No test added or removed; no skip/label changes.

Verification

  • task cli:format: clean.
  • go vet ./e2e/tests/up/: pass (compiles test files).
  • task cli:lint:ci (diff-only gate): 0 issues.
  • golangci-lint run ./e2e/tests/up/...: remaining findings are pre-existing funlen/cyclop/dupl in untouched code; none on new lines.
  • CodeRabbit review --committed on the commit: 0 findings.
  • Not run: full e2e suite (needs Kubernetes/Docker).

Review

CodeRabbit: 0 findings. Skipped findings: none.

Summary by CodeRabbit

  • Tests
    • Updated end-to-end tests for Kubernetes Dockerless and SSH-agent workflows to use shared command-running and workspace pod discovery helpers.
    • The tests continue to verify workspace creation, reuse and recreation, checkout contents, SSH-agent cleanup, and Kubernetes command execution. Workspace pod discovery now checks for a ready pod with a valid identifier and retries for up to 30 seconds.

Replace per-file copies of the kubectl/ssh command runner and workspace pod discovery with one shared set in e2e/tests/up/fixture_command.go: runFixtureCommand, fixtureCommand, and fixtureWorkspacePod. Timeouts are kept per call site.

Failure text for the shared wrapper is now 'fixture command ...' for both call paths. Pod discovery gains the selector and GinkgoWriter diagnostics on the dockerless path.
@netlify

netlify Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 720d443
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6ad0255718c956fc66f5ac52

@netlify

netlify Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit 720d443
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6ad025580d3c2de6c2ee015b

@coderabbitai

coderabbitai Bot commented Oct 15, 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: eddc379b-dfad-424e-a5f6-2d50aafa16aa
📥 Commits

Reviewing files that changed from the base of the PR and between 923b75a and 720d443.

📒 Files selected for processing: 3
  • e2e/tests/up/fixture_command.go
  • e2e/tests/up/provider_kubernetes_dockerless_path.go
  • e2e/tests/up/provider_kubernetes_ssh_agent.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 change adds shared helpers for timed command execution and ready workspace-pod discovery. Two Kubernetes end-to-end tests use these helpers in place of their local command and pod-discovery helpers.

Changes: Kubernetes fixture command migration

Layer / File(s) Summary
Shared command and pod-discovery helpers
e2e/tests/up/fixture_command.go
Adds helpers for timed command execution, command errors that fail the current spec, and polling for exactly one workspace pod with a nonempty UID and a true PodReady condition.
Dockerless-path test migration
e2e/tests/up/provider_kubernetes_dockerless_path.go
Uses the shared helpers for namespace operations, pod discovery, and pod execution. Removes the local kubectl and pod-polling helpers.
SSH-agent test migration
e2e/tests/up/provider_kubernetes_ssh_agent.go
Uses the shared helpers for Kubernetes, Git, Docker, and SSH commands, and for workspace-pod discovery. Removes the local command and pod-polling helpers.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to 720d4

The fixture-helper migration is mergeable after normal checks; no behavior regression was established.

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 9 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
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.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: the Kubernetes fixture command runner is consolidated into a shared helper used by the up e2e tests. The summary confirms that the local kubectl and kind SSH wrappers …
  • 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.

@skevetter
skevetter marked this pull request as ready for review October 15, 2026 01:45
@skevetter
skevetter marked this pull request as draft October 15, 2026 01:46
@mergify

mergify Bot commented Oct 15, 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 marked this pull request as ready for review October 15, 2026 01:53
@skevetter
skevetter merged commit 23bbdc9 into main Oct 15, 2026
109 checks passed
@skevetter
skevetter deleted the refactor/e2e-dedupe-kubectl-fixture-runners branch October 15, 2026 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant