diff --git a/internal/uploads/worker_progress_test.go b/internal/uploads/worker_progress_test.go index b6e1cf1..b3d8e68 100644 --- a/internal/uploads/worker_progress_test.go +++ b/internal/uploads/worker_progress_test.go @@ -163,3 +163,34 @@ func TestWorkerProgress_TheLogNamesEveryPhaseInOrderAndNeverTheTranscriptOrThePa assert.NotContains(t, out, "zebrakaka", "no transcript text in the log") assert.NotContains(t, out, r.tmp, "no spool path, which carries the upload's identity, in the log") } + +func TestWorkerProgress_AFailureLogsAKindNeverTheErrorTextOrThePath(t *testing.T) { + tests := []struct { + name string + setup func(*wrig) + kind string + }{ + {"conversion fails and names the spool file", func(r *wrig) { + r.conv.err = errors.New("Error opening input file " + r.tmp + "/upload-a: Invalid data zebrakaka") + }, "kind=error"}, + {"every engine fails and the gateway echoed a word", func(r *wrig) { + r.tr.err = errors.New("gateway echoed: zebrakaka secret words") + }, "kind=error"}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + r := newWRig(t, time.Minute) + tt.setup(r) + buf := &syncLog{} + w := newProgressWorker(t, r, r.tr, uploads.WithLogger(slog.New(slog.NewTextHandler(buf, nil)))) + + w.Process(context.Background(), r.spool(t, "a")) + + out := buf.String() + assert.NotContains(t, out, "zebrakaka", "provider text or file contents in the log") + assert.NotContains(t, out, r.tmp, "the spool path in the log") + assert.Contains(t, out, tt.kind) + assert.Contains(t, out, "upload=a") + }) + } +}