(t *testing.T)
| 34 | } |
| 35 | |
| 36 | func TestShouldRejectLockContentionImmediately(t *testing.T) { |
| 37 | cfg := &config.Configuration{ |
| 38 | Queue: config.QueueConfig{ |
| 39 | RejectLockContentionImmediately: true, |
| 40 | }, |
| 41 | } |
| 42 | |
| 43 | if !shouldRejectLockContentionImmediately(cfg, fmt.Errorf("failed to acquire lock: already held")) { |
| 44 | t.Fatal("expected lock contention to reject immediately when enabled") |
| 45 | } |
| 46 | |
| 47 | if shouldRejectLockContentionImmediately(cfg, fmt.Errorf("random transient database error")) { |
| 48 | t.Fatal("expected non-lock error not to reject immediately") |
| 49 | } |
| 50 | |
| 51 | cfg.Queue.RejectLockContentionImmediately = false |
| 52 | if shouldRejectLockContentionImmediately(cfg, fmt.Errorf("failed to acquire lock: already held")) { |
| 53 | t.Fatal("expected lock contention not to reject immediately when disabled") |
| 54 | } |
| 55 | } |
nothing calls this directly
no test coverage detected