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