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