diff --git a/internal/uploads/worker_test.go b/internal/uploads/worker_test.go index 2454795..e8abbf7 100644 --- a/internal/uploads/worker_test.go +++ b/internal/uploads/worker_test.go @@ -25,6 +25,9 @@ type wStore struct { startErr error saves [][]domain.ProgressStep beats int + // beatDelay makes each heartbeat write slow, so one is still in flight when a job + // ends -- which is what proves the worker waits for its heartbeat to finish. + beatDelay time.Duration } func newWStore() *wStore { @@ -60,6 +63,7 @@ func (s *wStore) SaveProgress(_ context.Context, _, _ string, steps []domain.Pro } func (s *wStore) Heartbeat(context.Context, string, string) error { + time.Sleep(s.beatDelay) s.mu.Lock() defer s.mu.Unlock() s.beats++