(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestHasReachedMaxRetryAttempt(t *testing.T) { |
| 11 | cfg := &config.Configuration{ |
| 12 | Queue: config.QueueConfig{ |
| 13 | MaxRetryAttempts: 5, |
| 14 | }, |
| 15 | } |
| 16 | |
| 17 | tests := []struct { |
| 18 | name string |
| 19 | retryCount int |
| 20 | want bool |
| 21 | }{ |
| 22 | {name: "below max", retryCount: 4, want: false}, |
| 23 | {name: "at max", retryCount: 5, want: true}, |
| 24 | {name: "above max", retryCount: 6, want: true}, |
| 25 | } |
| 26 | |
| 27 | for _, tt := range tests { |
| 28 | t.Run(tt.name, func(t *testing.T) { |
| 29 | if got := hasReachedMaxRetryAttempt(cfg, tt.retryCount); got != tt.want { |
| 30 | t.Fatalf("hasReachedMaxRetryAttempt() = %v, want %v", got, tt.want) |
| 31 | } |
| 32 | }) |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | func TestShouldRejectLockContentionImmediately(t *testing.T) { |
| 37 | cfg := &config.Configuration{ |
nothing calls this directly
no test coverage detected