getBundle retries successfully when the initial HTTP request returns a 5XX status code
(t *testing.T)
| 270 | // getBundle retries successfully when the initial HTTP request returns |
| 271 | // a 5XX status code |
| 272 | func TestGetBundle_SuccessfulRetry(t *testing.T) { |
| 273 | mockHTTPClient := &failAfterNCallsHttpClient{ |
| 274 | FailOnCallN: 1, |
| 275 | FailOnAllSubsequentCalls: false, |
| 276 | } |
| 277 | |
| 278 | c := &LiveClient{ |
| 279 | externalHttpClient: mockHTTPClient, |
| 280 | logger: io.NewTestHandler(), |
| 281 | } |
| 282 | |
| 283 | b, err := c.getBundle("mybundleurl") |
| 284 | require.NoError(t, err) |
| 285 | require.Equal(t, "application/vnd.dev.sigstore.bundle.v0.3+json", b.GetMediaType()) |
| 286 | mockHTTPClient.AssertNumberOfCalls(t, "OnGetFailAfterNCalls", 2) |
| 287 | } |
| 288 | |
| 289 | // getBundle does not retry when the function fails with a permanent backoff error condition |
| 290 | func TestGetBundle_PermanentBackoffFail(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…