diff --git a/tests/e2e/windows/e2e_test.go b/tests/e2e/windows/e2e_test.go index 6db27b9..4b27ace 100644 --- a/tests/e2e/windows/e2e_test.go +++ b/tests/e2e/windows/e2e_test.go @@ -132,8 +132,8 @@ func buildImage(t *testing.T, ctx context.Context, repoRoot, image, platform, ba // runOne starts one long-lived container per combo and drives the whole // E2E flow (setup -> install -> verify) through pwsh exec calls, asserting // in Go. A combo passes when every phase exits 0 and the outputs carry the -// expected markers. vfox main combos run against a VFOX_HOME containing a -// space (see vfoxHome). +// expected markers. Every combo runs against a VFOX_HOME containing a +// space (see spacedVfoxHome). func runOne(t *testing.T, ctx context.Context, image, platform, arch string, c common.Combo) { t.Helper() prefix := c.Prefix(platform) @@ -181,7 +181,7 @@ func runOne(t *testing.T, ctx context.Context, image, platform, arch string, c c procArch := procArchOfContainer(ctx, t, ctr) t.Logf("=== vfox %s, java@%s, %s (%s) ===", c.Vfox, common.Spec(c.Distribution, version), platform, procArch) - box := setupSlotEnv(ctx, t, ctr, c.Slug(), c.Vfox) + box := setupSlotEnv(ctx, t, ctr, c.Slug()) setupVfox(ctx, t, ctr, box, c.Vfox) checkMissingVersionRejected(ctx, t, ctr, box, c.Distribution, version, arch) diff --git a/tests/e2e/windows/matrix_test.go b/tests/e2e/windows/matrix_test.go index a758fda..16d5591 100644 --- a/tests/e2e/windows/matrix_test.go +++ b/tests/e2e/windows/matrix_test.go @@ -14,10 +14,7 @@ package windows -import ( - "strings" - "testing" -) +import "testing" func TestMaxJobsDefault(t *testing.T) { t.Setenv("E2E_MAX_JOBS", "") @@ -31,21 +28,6 @@ func TestMaxJobsDefault(t *testing.T) { } } -func TestVfoxHome(t *testing.T) { - profile := `C:\Users\ContainerAdministrator` - if got, want := vfoxHome(profile, "latest-tem", "latest"), - `C:\Users\ContainerAdministrator\vfox-e2e-runs\latest-tem\.vfox`; got != want { - t.Errorf("vfoxHome(latest) = %q, want %q", got, want) - } - got := vfoxHome(profile, "main-tem", "main") - if got != spacedVfoxHome { - t.Errorf("vfoxHome(main) = %q, want %q", got, spacedVfoxHome) - } - if !strings.Contains(got, " ") { - t.Errorf("vfoxHome(main) = %q, want a path containing a space", got) - } -} - func TestPwshQuote(t *testing.T) { if got := pwshQuote(`C:\a\b`); got != `'C:\a\b'` { t.Errorf("pwshQuote = %q", got) diff --git a/tests/e2e/windows/setup.go b/tests/e2e/windows/setup.go index 53f3de0..7650f1a 100644 --- a/tests/e2e/windows/setup.go +++ b/tests/e2e/windows/setup.go @@ -39,17 +39,6 @@ const ( spacedVfoxHome = `C:\Users\John Doe\.vfox` ) -// vfoxHome returns the $VFOX_HOME for a combo. The fix for Windows homes -// containing a space (https://github.com/version-fox/vfox/pull/712) is on -// vfox main only: released builds still fail on such paths, so only main -// runs against spacedVfoxHome while the others keep an unspaced slot home. -func vfoxHome(userProfile, slot, vfoxVersion string) string { - if vfoxVersion == "main" { - return spacedVfoxHome - } - return userProfile + `\vfox-e2e-runs\` + slot + `\.vfox` -} - // pwshQuote renders a single-quoted PowerShell string literal. func pwshQuote(s string) string { return "'" + strings.ReplaceAll(s, "'", "''") + "'" @@ -69,15 +58,17 @@ type slotBox struct { } // setupSlotEnv isolates the combo: USERPROFILE/TEMP/TMP point under -// vfox-e2e-runs\, while VFOX_HOME is a sibling .vfox (spacedVfoxHome -// for main), so parallel combos on one daemon never share vfox state. -func setupSlotEnv(ctx context.Context, t *testing.T, ctr tc.Container, slot, vfoxVersion string) slotBox { +// vfox-e2e-runs\, while VFOX_HOME is spacedVfoxHome. Each combo runs in +// its own container, so the shared VFOX_HOME never leaks between combos. Both +// vfox main and releases since v1.0.13 handle a home containing a space +// (https://github.com/version-fox/vfox/pull/712). +func setupSlotEnv(ctx context.Context, t *testing.T, ctr tc.Container, slot string) slotBox { t.Helper() userProfile := strings.TrimSpace(execOK(ctx, t, ctr, "$env:USERPROFILE")) containerPath := strings.TrimSpace(execOK(ctx, t, ctr, "$env:PATH")) procArch := strings.TrimSpace(execOK(ctx, t, ctr, "$env:PROCESSOR_ARCHITECTURE")) - home := vfoxHome(userProfile, slot, vfoxVersion) + home := spacedVfoxHome box := slotBox{slot: slot} box.slotRoot = userProfile + `\vfox-e2e-runs\` + slot box.tmp = box.slotRoot + `\tmp`