Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,15 @@ func TestDetachedWorkerHelper(t *testing.T) {
}
closeParent()
time.Sleep(100 * time.Millisecond)
if err := os.WriteFile(os.Getenv("ONE_UPDATE_TEST_MARKER"), []byte("finished"), 0o600); err != nil {
// Publish completion only after the contents are fully written and closed.
// Writing the marker directly lets the parent observe an empty file.
marker := os.Getenv("ONE_UPDATE_TEST_MARKER")
if err := os.WriteFile(marker+".tmp", []byte("finished"), 0o600); err != nil {
os.Exit(5)
}
if err := os.Rename(marker+".tmp", marker); err != nil {
os.Exit(6)
}
os.Exit(0)
}
}
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/tests/e2e/e2e_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ func isolateHome(t *testing.T, dir string) {
for _, key := range []string{"XDG_DATA_HOME", "XDG_STATE_HOME", "MISE_CONFIG_DIR", "MISE_DATA_DIR", "MISE_STATE_DIR", "MISE_CACHE_DIR"} {
t.Setenv(key, filepath.Join(dir, key))
}
// CI shares task artifacts across runs, independently of MISE_CACHE_DIR.
// Keep that outer cache from restoring outputs into a fresh test fixture.
t.Setenv("MISE_TASK_CACHE_DIR", filepath.Join(dir, "mise-task-artifacts"))
for _, key := range []string{"CODEX_HOME", "CLAUDE_CONFIG_DIR", "VIBE_HOME"} {
t.Setenv(key, "")
}
Expand Down
13 changes: 12 additions & 1 deletion packages/cli/tests/e2e/tasks_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ func appendRootTaskConfig(t *testing.T, root, value string) {
}

func TestE2E_TasksRestoreArtifactsAndInvalidateRootConfiguration(t *testing.T) {
// CI runs race and plain suites with the same outer artifact cache. A new
// fixture must execute its first build even when identical artifacts exist.
t.Setenv("MISE_TASK_CACHE_DIR", t.TempDir())
for _, name := range []string{"first", "fresh-home"} {
t.Run(name, testTasksRestoreArtifactsAndInvalidateRootConfiguration)
}
}

func testTasksRestoreArtifactsAndInvalidateRootConfiguration(t *testing.T) {
root := buildFixture(t, true)
for _, project := range []struct{ name, dir string }{{"web", "apps/web"}, {"lib", "packages/lib"}} {
name, dir := project.name, project.dir
Expand Down Expand Up @@ -139,9 +148,11 @@ func TestE2E_NativeMiseIncludedTOMLTask(t *testing.T) {
}

func TestE2E_TasksReuseArtifactsAcrossCheckouts(t *testing.T) {
t.Setenv("MISE_TASK_CACHE_DIR", t.TempDir())
cache := t.TempDir()
for i := 0; i < 2; i++ {
root := buildFixture(t, true)
// Opt into sharing only after the fixture has isolated its home/cache.
t.Setenv("MISE_TASK_CACHE_DIR", cache)
for _, project := range []struct{ name, dir string }{{"web", "apps/web"}, {"lib", "packages/lib"}} {
name, dir := project.name, project.dir
buildWrite(t, root, dir+"/build.sh", "#!/bin/sh\nmkdir -p dist\necho portable-artifact > dist/value\necho executed >> executions\n")
Expand Down
Loading