MCPcopy Index your code
hub / github.com/cli/cli / TestGetBundle_SuccessfulRetry

Function TestGetBundle_SuccessfulRetry

pkg/cmd/attestation/api/client_test.go:272–287  ·  view source on GitHub ↗

getBundle retries successfully when the initial HTTP request returns a 5XX status code

(t *testing.T)

Source from the content-addressed store, hash-verified

270// getBundle retries successfully when the initial HTTP request returns
271// a 5XX status code
272func 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
290func TestGetBundle_PermanentBackoffFail(t *testing.T) {

Callers

nothing calls this directly

Calls 3

getBundleMethod · 0.95
NewTestHandlerFunction · 0.92
EqualMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…