(t *testing.T)
| 35 | ) |
| 36 | |
| 37 | func TestRetryAfterDuration(t *testing.T) { |
| 38 | tc := []struct { |
| 39 | name string |
| 40 | tInput string |
| 41 | expected model.Duration |
| 42 | }{ |
| 43 | { |
| 44 | name: "seconds", |
| 45 | tInput: "120", |
| 46 | expected: model.Duration(time.Second * 120), |
| 47 | }, |
| 48 | { |
| 49 | name: "date-time default", |
| 50 | tInput: time.RFC1123, // Expected layout is http.TimeFormat, hence an error. |
| 51 | expected: 0, |
| 52 | }, |
| 53 | { |
| 54 | name: "retry-after not provided", |
| 55 | tInput: "", // Expected layout is http.TimeFormat, hence an error. |
| 56 | expected: 0, |
| 57 | }, |
| 58 | } |
| 59 | for _, c := range tc { |
| 60 | if got := retryAfterDuration(c.tInput); got != time.Duration(c.expected) { |
| 61 | t.Fatal("expected", c.expected, "got", got) |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | type mockStorage struct { |
| 67 | v2Reqs []*writev2.Request |
nothing calls this directly
no test coverage detected