Remove retired reporting and diagnostic code
This commit is contained in:
@@ -93,6 +93,42 @@ func TestProcessUsesResolvedReportingMode(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestProcessChecksOnlyTheActiveReportDirectory(t *testing.T) {
|
||||
for _, tc := range []struct {
|
||||
name string
|
||||
flags []string
|
||||
wantReport bool
|
||||
wantError bool
|
||||
}{
|
||||
{"file output ignores blank configured directory", nil, true, false},
|
||||
{"explicit blank directory", []string{"--report-dir="}, false, true},
|
||||
{"disabled reporting ignores explicit blank directory", []string{"--reporting=false", "--report-dir="}, false, false},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
configPath := filepath.Join(dir, "config.yml")
|
||||
if err := os.WriteFile(configPath, []byte("version: 3\npipeline: {stages: []}\nreporting: {stdout_dir: ''}\n"), 0600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
transcript := filepath.Join(dir, "transcript.json")
|
||||
if err := os.WriteFile(transcript, []byte(`[{"speaker":"Alice","start":0,"end":1,"text":"hello"}]`), 0600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
output := filepath.Join(dir, "output.json")
|
||||
args := append([]string{"process", "--config", configPath, "--output", output}, tc.flags...)
|
||||
var stdout, stderr bytes.Buffer
|
||||
status := Run(context.Background(), append(args, transcript), &stdout, &stderr)
|
||||
if (status != 0) != tc.wantError || (tc.wantError && !strings.Contains(stderr.String(), "report directory is required")) {
|
||||
t.Fatalf("status=%d stdout=%q stderr=%q", status, stdout.String(), stderr.String())
|
||||
}
|
||||
_, err := os.Stat(filepath.Join(dir, "errors.yml"))
|
||||
if (tc.wantReport && err != nil) || (!tc.wantReport && !os.IsNotExist(err)) {
|
||||
t.Fatalf("report file: %v, want present=%t", err, tc.wantReport)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestProcessCollectionFlags(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
for name, contents := range map[string]string{
|
||||
|
||||
Reference in New Issue
Block a user