diff --git a/distribution/xfer/transfer_test.go b/distribution/xfer/transfer_test.go index a86e27959e..f8f8e96fe0 100644 --- a/distribution/xfer/transfer_test.go +++ b/distribution/xfer/transfer_test.go @@ -10,11 +10,11 @@ import ( func TestTransfer(t *testing.T) { makeXferFunc := func(id string) DoFunc { - return func(progressChan chan<- progress.Progress, start <-chan struct{}, inactive chan<- struct{}) Transfer { + return func(progressChan chan<- progress.Progress, start <-chan struct{}, _ chan<- struct{}) Transfer { select { case <-start: default: - t.Fatalf("transfer function not started even though concurrency limit not reached") + t.Errorf("%s: transfer function not started even though concurrency limit not reached", id) } xfer := NewTransfer() @@ -38,7 +38,7 @@ func TestTransfer(t *testing.T) { for p := range progressChan { val, present := receivedProgress[p.ID] if present && p.Current <= val { - t.Fatalf("got unexpected progress value: %d (expected %d)", p.Current, val+1) + t.Errorf("%s: got unexpected progress value: %d (expected <= %d)", p.ID, p.Current, val) } receivedProgress[p.ID] = p.Current } @@ -72,13 +72,13 @@ func TestConcurrencyLimit(t *testing.T) { var runningJobs int32 makeXferFunc := func(id string) DoFunc { - return func(progressChan chan<- progress.Progress, start <-chan struct{}, inactive chan<- struct{}) Transfer { + return func(progressChan chan<- progress.Progress, start <-chan struct{}, _ chan<- struct{}) Transfer { xfer := NewTransfer() go func() { <-start totalJobs := atomic.AddInt32(&runningJobs, 1) if int(totalJobs) > concurrencyLimit { - t.Fatalf("too many jobs running") + t.Errorf("%s: too many jobs running (%d > %d)", id, totalJobs, concurrencyLimit) } for i := 0; i <= 10; i++ { progressChan <- progress.Progress{ID: id, Action: "testing", Current: int64(i), Total: 10} @@ -137,7 +137,7 @@ func TestInactiveJobs(t *testing.T) { <-start totalJobs := atomic.AddInt32(&runningJobs, 1) if int(totalJobs) > concurrencyLimit { - t.Fatalf("too many jobs running") + t.Errorf("%s: too many jobs running (%d > %d)", id, totalJobs, concurrencyLimit) } for i := 0; i <= 10; i++ { progressChan <- progress.Progress{ID: id, Action: "testing", Current: int64(i), Total: 10} @@ -191,7 +191,7 @@ func TestWatchRelease(t *testing.T) { ready := make(chan struct{}) makeXferFunc := func(id string) DoFunc { - return func(progressChan chan<- progress.Progress, start <-chan struct{}, inactive chan<- struct{}) Transfer { + return func(progressChan chan<- progress.Progress, start <-chan struct{}, _ chan<- struct{}) Transfer { xfer := NewTransfer() go func() { defer func() { @@ -280,7 +280,7 @@ func TestWatchRelease(t *testing.T) { func TestWatchFinishedTransfer(t *testing.T) { makeXferFunc := func(id string) DoFunc { - return func(progressChan chan<- progress.Progress, start <-chan struct{}, inactive chan<- struct{}) Transfer { + return func(progressChan chan<- progress.Progress, _ <-chan struct{}, _ chan<- struct{}) Transfer { xfer := NewTransfer() go func() { // Finish immediately @@ -322,7 +322,7 @@ func TestDuplicateTransfer(t *testing.T) { var xferFuncCalls int32 makeXferFunc := func(id string) DoFunc { - return func(progressChan chan<- progress.Progress, start <-chan struct{}, inactive chan<- struct{}) Transfer { + return func(progressChan chan<- progress.Progress, _ <-chan struct{}, _ chan<- struct{}) Transfer { atomic.AddInt32(&xferFuncCalls, 1) xfer := NewTransfer() go func() {