(t *testing.T)
| 13 | ) |
| 14 | |
| 15 | func TestFindExperimentStatePath(t *testing.T) { |
| 16 | t.Run("returns empty when logsPath is empty", func(t *testing.T) { |
| 17 | assert.Empty(t, findExperimentStatePath(""), "should return empty string for empty logsPath") |
| 18 | }) |
| 19 | |
| 20 | t.Run("finds state.json at root", func(t *testing.T) { |
| 21 | dir := t.TempDir() |
| 22 | statePath := filepath.Join(dir, "state.json") |
| 23 | require.NoError(t, os.WriteFile(statePath, []byte("{}"), 0o600)) |
| 24 | |
| 25 | got := findExperimentStatePath(dir) |
| 26 | assert.Equal(t, statePath, got, "should find state.json at logsPath root") |
| 27 | }) |
| 28 | |
| 29 | t.Run("finds state.json in experiment subdirectory", func(t *testing.T) { |
| 30 | dir := t.TempDir() |
| 31 | subDir := filepath.Join(dir, "experiment") |
| 32 | require.NoError(t, os.MkdirAll(subDir, 0o755)) |
| 33 | statePath := filepath.Join(subDir, "state.json") |
| 34 | require.NoError(t, os.WriteFile(statePath, []byte("{}"), 0o600)) |
| 35 | |
| 36 | got := findExperimentStatePath(dir) |
| 37 | assert.Equal(t, statePath, got, "should find state.json in experiment subdirectory") |
| 38 | }) |
| 39 | |
| 40 | t.Run("returns empty when no state.json exists", func(t *testing.T) { |
| 41 | dir := t.TempDir() |
| 42 | got := findExperimentStatePath(dir) |
| 43 | assert.Empty(t, got, "should return empty string when no state.json found") |
| 44 | }) |
| 45 | } |
| 46 | |
| 47 | func TestExtractExperimentData(t *testing.T) { |
| 48 | t.Run("returns nil for empty logsPath", func(t *testing.T) { |
nothing calls this directly
no test coverage detected