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

Function TestGetBundle_PermanentBackoffFail

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

getBundle does not retry when the function fails with a permanent backoff error condition

(t *testing.T)

Source from the content-addressed store, hash-verified

288
289// getBundle does not retry when the function fails with a permanent backoff error condition
290func TestGetBundle_PermanentBackoffFail(t *testing.T) {
291 mockHTTPClient := &invalidBundleClient{}
292 c := &LiveClient{
293 externalHttpClient: mockHTTPClient,
294 logger: io.NewTestHandler(),
295 }
296
297 b, err := c.getBundle("mybundleurl")
298 // var permanent *backoff.PermanentError
299 //require.IsType(t, &backoff.PermanentError{}, err)
300 require.Error(t, err)
301 require.Nil(t, b)
302 mockHTTPClient.AssertNumberOfCalls(t, "OnGetInvalidBundle", 1)
303}
304
305// getBundle retries when the HTTP request fails
306func TestGetBundle_RequestFail(t *testing.T) {

Callers

nothing calls this directly

Calls 3

getBundleMethod · 0.95
NewTestHandlerFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected