Skip to content

Commit d657c50

Browse files
authored
test(e2e): run vfox latest against a Windows home containing a space (#39)
1 parent a4b727f commit d657c50

4 files changed

Lines changed: 18 additions & 43 deletions

File tree

‎docs/e2e.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,12 @@ The `windows-11-arm` runner has no Windows Hypervisor Platform feature, so
166166
Hyper-V isolation is unavailable; process isolation needs only the
167167
Containers feature.
168168

169-
The `main` combos run with `VFOX_HOME` pointing inside a path containing a
169+
Every combination runs with `VFOX_HOME` pointing inside a path containing a
170170
space (`C:\Users\John Doe\.vfox`), mirroring
171-
[issue #33](https://github.com/version-fox/vfox-flutter/issues/33). Only vfox
172-
`main` carries the fix for such paths
173-
([vfox#712](https://github.com/version-fox/vfox/pull/712)), so `latest`
174-
combinations still run with an unspaced home.
171+
[issue #33](https://github.com/version-fox/vfox-flutter/issues/33). vfox
172+
handles such paths since 1.0.13
173+
([vfox#712](https://github.com/version-fox/vfox/pull/712)), so the `latest`
174+
release and `main` both run against it.
175175

176176
### x64
177177

‎tests/e2e/windows/e2e_test.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ func buildImage(t *testing.T, ctx context.Context, repoRoot, image, platform, ba
132132
// runOne starts one long-lived container per combo and drives the whole
133133
// E2E flow (setup -> install -> verify) through pwsh exec calls, asserting
134134
// in Go. A combo passes when every phase exits 0 and the outputs carry the
135-
// expected markers. vfox main combos run against a VFOX_HOME containing a
136-
// space (see vfoxHome).
135+
// expected markers. Every combo runs against a VFOX_HOME containing a space
136+
// (see spacedVfoxHome).
137137
func runOne(t *testing.T, ctx context.Context, image, platform string, c common.Combo) {
138138
t.Helper()
139139
prefix := c.Prefix(platform)
@@ -183,7 +183,7 @@ func runOne(t *testing.T, ctx context.Context, image, platform string, c common.
183183
procArch := procArchOfContainer(ctx, t, ctr)
184184
t.Logf("=== vfox %s, node %s, mirror %s, %s (%s) ===", c.Vfox, version, c.Mirror, platform, procArch)
185185

186-
box := setupSlotEnv(ctx, t, ctr, c.Slug(), c.Vfox)
186+
box := setupSlotEnv(ctx, t, ctr, c.Slug())
187187
checkMirrorReachable(ctx, t, ctr, c.Mirror)
188188
setupVfox(ctx, t, ctr, box, c.Vfox)
189189
checkBogusMirrorRejected(ctx, t, ctr, box)

‎tests/e2e/windows/matrix_test.go‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package windows
1616

1717
import (
18-
"strings"
1918
"testing"
2019
)
2120

@@ -39,21 +38,6 @@ func TestReleasesIndex(t *testing.T) {
3938
}
4039
}
4140

42-
func TestVfoxHome(t *testing.T) {
43-
profile := `C:\Users\ContainerAdministrator`
44-
if got, want := vfoxHome(profile, "latest-default", "latest"),
45-
`C:\Users\ContainerAdministrator\vfox-e2e-runs\latest-default\.vfox`; got != want {
46-
t.Errorf("vfoxHome(latest) = %q, want %q", got, want)
47-
}
48-
got := vfoxHome(profile, "main-default", "main")
49-
if got != spacedVfoxHome {
50-
t.Errorf("vfoxHome(main) = %q, want %q", got, spacedVfoxHome)
51-
}
52-
if !strings.Contains(got, " ") {
53-
t.Errorf("vfoxHome(main) = %q, want a path containing a space", got)
54-
}
55-
}
56-
5741
func TestPwshQuote(t *testing.T) {
5842
if got := pwshQuote(`C:\a\b`); got != `'C:\a\b'` {
5943
t.Errorf("pwshQuote = %q", got)

‎tests/e2e/windows/setup.go‎

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,13 @@ const (
3535

3636
// spacedVfoxHome is the default vfox home of a Windows account whose
3737
// name contains a space, the layout reported in
38-
// https://github.com/version-fox/vfox-flutter/issues/33 .
38+
// https://github.com/version-fox/vfox-flutter/issues/33 . Every combo
39+
// runs against it: vfox handles such paths since 1.0.13
40+
// (https://github.com/version-fox/vfox/pull/712), so the latest release
41+
// and main both carry the fix.
3942
spacedVfoxHome = `C:\Users\John Doe\.vfox`
4043
)
4144

42-
// vfoxHome returns the $VFOX_HOME for a combo. The fix for Windows homes
43-
// containing a space (https://github.com/version-fox/vfox/pull/712) is on
44-
// vfox main only: released builds still fail on such paths, so only main
45-
// runs against spacedVfoxHome while the others keep an unspaced slot home.
46-
func vfoxHome(userProfile, slot, vfoxVersion string) string {
47-
if vfoxVersion == "main" {
48-
return spacedVfoxHome
49-
}
50-
return userProfile + `\vfox-e2e-runs\` + slot + `\.vfox`
51-
}
52-
5345
// pwshQuote renders a single-quoted PowerShell string literal.
5446
func pwshQuote(s string) string {
5547
return "'" + strings.ReplaceAll(s, "'", "''") + "'"
@@ -96,15 +88,14 @@ type slotBox struct {
9688
}
9789

9890
// setupSlotEnv isolates the combo: USERPROFILE/TEMP/TMP point under
99-
// vfox-e2e-runs\<slot>, while VFOX_HOME is a sibling .vfox (spacedVfoxHome
100-
// for main), so parallel combos on one daemon never share vfox state.
101-
func setupSlotEnv(ctx context.Context, t *testing.T, ctr tc.Container, slot, vfoxVersion string) slotBox {
91+
// vfox-e2e-runs\<slot>, while VFOX_HOME is spacedVfoxHome. Every combo runs
92+
// in its own container, so that shared home never mixes vfox state.
93+
func setupSlotEnv(ctx context.Context, t *testing.T, ctr tc.Container, slot string) slotBox {
10294
t.Helper()
10395
userProfile := strings.TrimSpace(execOK(ctx, t, ctr, "$env:USERPROFILE"))
10496
containerPath := strings.TrimSpace(execOK(ctx, t, ctr, "$env:PATH"))
10597
procArch := strings.TrimSpace(execOK(ctx, t, ctr, "$env:PROCESSOR_ARCHITECTURE"))
10698

107-
home := vfoxHome(userProfile, slot, vfoxVersion)
10899
box := slotBox{slot: slot}
109100
box.slotRoot = userProfile + `\vfox-e2e-runs\` + slot
110101
box.tmp = box.slotRoot + `\tmp`
@@ -113,7 +104,7 @@ func setupSlotEnv(ctx context.Context, t *testing.T, ctr tc.Container, slot, vfo
113104
box.pluginZw = box.workDir + `\nodejs.zip`
114105
box.vars = []string{
115106
"USERPROFILE=" + box.slotRoot,
116-
"VFOX_HOME=" + home,
107+
"VFOX_HOME=" + spacedVfoxHome,
117108
"TEMP=" + box.tmp,
118109
"TMP=" + box.tmp,
119110
"PATH=" + box.workDir + ";" + containerPath,
@@ -123,8 +114,8 @@ func setupSlotEnv(ctx context.Context, t *testing.T, ctr tc.Container, slot, vfo
123114
"New-Item -ItemType Directory -Force -Path %s | Out-Null; "+
124115
"New-Item -ItemType Directory -Force -Path %s | Out-Null; "+
125116
"New-Item -ItemType Directory -Force -Path %s | Out-Null",
126-
pwshQuote(box.tmp), pwshQuote(box.workDir), pwshQuote(home)))
127-
t.Logf("PASS slot %s isolated at %s (vfox home %s, arch %s)", slot, box.slotRoot, home, procArch)
117+
pwshQuote(box.tmp), pwshQuote(box.workDir), pwshQuote(spacedVfoxHome)))
118+
t.Logf("PASS slot %s isolated at %s (vfox home %s, arch %s)", slot, box.slotRoot, spacedVfoxHome, procArch)
128119
return box
129120
}
130121

0 commit comments

Comments
 (0)