Skip to content

Commit

Permalink
internal/e2e: set CUE_MODCACHE in TestScript's Setup
Browse files Browse the repository at this point in the history
Mirroring the same strategy that Roger took for cmd/cue/cmd.TestScript.
Otherwise, since internal/e2e.TestScript leaves HOME as /no-home,
cmd/cue would try to create a cache directory inside there and fail.

Signed-off-by: Daniel Martí <[email protected]>
Change-Id: I8e7e56927c709ef740f9caf929a48b68292c5674
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1173684
Unity-Result: CUE porcuepine <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
Reviewed-by: Paul Jolly <[email protected]>
  • Loading branch information
mvdan committed Dec 15, 2023
1 parent 7dc80ff commit db98219
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/e2e/script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ func TestScript(t *testing.T) {
env.Setenv("CUE_EXPERIMENT", "modules")
env.Setenv("CUE_REGISTRY", "registry.cue.works")
env.Setenv("CUE_CACHED_GOBIN", os.Getenv("CUE_CACHED_GOBIN"))

// Just like cmd/cue/cmd.TestScript, set up a separate modcache dir per test.
env.Setenv("CUE_MODCACHE", filepath.Join(env.WorkDir, "tmp/modcache"))
return nil
},
Cmds: map[string]func(ts *testscript.TestScript, neg bool, args []string){
Expand Down

0 comments on commit db98219

Please sign in to comment.