Skip to content

refactor(e2e): add CopyTestdata fixture helper - #1536

Merged
skevetter merged 1 commit into
mainfrom
refactor/e2e-testdata-fixture-helper
Oct 18, 2026
Merged

skevetter merged 1 commit into
mainfrom
refactor/e2e-testdata-fixture-helper

Conversation

@skevetter

@skevetter skevetter commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Theme

e2e (Ginkgo fixtures): dedupe the testdata copy/cleanup pattern into framework.

Change

  • Adds framework.CopyTestdata(testdataPath, initialDir string) string in e2e/framework/workspace.go. It calls CopyToTempDir, asserts the error with ExpectNoErrorWithOffset(1, err), registers ginkgo.DeferCleanup(CleanupTempDir, initialDir, tempDir), and returns tempDir.
  • Migrates exact matches of the three-line block (CopyToTempDir + ExpectNoError + DeferCleanup(CleanupTempDir, ...)) in e2e/tests/{build,provider,rename,snapshot,up-features}. 6 files, +126 / -195.
  • Not migrated, by design: sites whose cleanup is a closure that does more work (e.g. ssh/ssh_tunnel_mode.go, which also deletes the workspace), CopyToTempDirWithoutChdir sites, and SetupDockerWorkspace. Those are left for a separate decision.
  • Behaviour is unchanged: CopyTestdata still calls CopyToTempDir (same cwd change, same cleanup order), and no labels or specs were added, removed, or renamed.

Verification run

  • go build -gcflags=-e ./e2e/... and go vet ./e2e/...: clean.
  • mise run cli:format and mise run cli:lint:ci: 0 issues.
  • go test -count=1 ./e2e/framework/...: pass.
  • go run github.com/onsi/ginkgo/v2/ginkgo --dry-run --no-color ./e2e (root suite), run against a git worktree of origin/main and against this branch: Ran 503 of 503 Specs on both.
  • CodeRabbit CLI: coderabbit review --uncommitted --base origin/main --agent: completed, 0 findings, reviewed the 6 changed files.

Not run: per-package ginkgo dry-runs, the --json-report label-coverage check, real e2e execution (needs Docker/kind), actionlint (no workflow changes).

CI jobs that exercise this change

From the include: matrix in .github/workflows/pr-ci.yml, matched by label name only (path filters and label-filter selection were not checked):

  • up-features: ubuntu-latest and windows-latest
  • provider: ubuntu-latest and windows-latest
  • snapshot: ubuntu-latest
  • build: ubuntu-latest
  • rename: ubuntu-latest

No workflow files changed. Draft PR; not merged.

Summary by CodeRabbit

  • Tests
    • Standardized temporary workspace setup and cleanup across build, provider, rename, snapshot, and feature end-to-end tests.
    • Test fixtures are removed automatically after use, and the working directory is restored.
    • Existing test scenarios and checks remain in place.

@skevetter skevetter added the ci-refactor CI/e2e refactor label Oct 18, 2026
@netlify

netlify Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit 24f741f
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6ad41502d535565a4eb7c78c

@coderabbitai

coderabbitai Bot commented Oct 18, 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: d35ce348-b4df-4229-ac54-48cbdd17a531
📥 Commits

Reviewing files that changed from the base of the PR and between e0fe773 and 24f741f.

📒 Files selected for processing: 6
  • e2e/framework/workspace.go
  • e2e/tests/build/build.go
  • e2e/tests/provider/provider.go
  • e2e/tests/rename/rename.go
  • e2e/tests/snapshot/snapshot.go
  • e2e/tests/up-features/up_features.go

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

📝 Walkthrough

The E2E framework adds CopyTestdata to copy fixtures and register cleanup. Build, provider, rename, snapshot, and feature tests use it with initialDir instead of managing fixture copies and temporary-directory cleanup separately.

Changes: E2E fixture setup

Layer / File(s) Summary
Add test-data copy helper
e2e/framework/workspace.go
CopyTestdata copies test data, reports copy errors, registers cleanup, and returns the temporary directory path.
Update build test fixtures
e2e/tests/build/build.go
Docker, Compose, and Kubernetes build tests use CopyTestdata with initialDir instead of checked CopyToTempDir calls and explicit temporary-directory cleanup.
Update provider and rename test fixtures
e2e/tests/provider/provider.go, e2e/tests/rename/rename.go
Provider and workspace rename tests use CopyTestdata with initialDir and remove separate fixture-copy error checks and cleanup registrations.
Update snapshot test fixtures
e2e/tests/snapshot/snapshot.go
Snapshot tests use CopyTestdata for fixtures and remove explicit temporary-directory cleanup registrations.
Update feature test fixtures
e2e/tests/up-features/up_features.go
Feature tests use CopyTestdata with initialDir and remove separate fixture-copy error checks and cleanup registrations. The integrity test still restores the working directory before its second copy.

Priority: ⬇️ Low

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

Change: Refactor

Merge Risk: ⚪ Minimal · up to 24f74

The fixture refactor preserves the described copy and cleanup behavior, and no concrete issue remains that should block merging after ordinary checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 6 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 identifies the main change: adding the CopyTestdata fixture helper for E2E tests.
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 18, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 24f741f
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6ad4150209b2695f6d9deea3

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

mergify Bot commented Oct 18, 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 56102eb into main Oct 18, 2026
111 checks passed
@skevetter
skevetter deleted the refactor/e2e-testdata-fixture-helper branch October 18, 2026 01:53
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/l

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant