MCPcopy Create free account
hub / github.com/cli/cli / TestGetBundle_PermanentBackoffFail

Function TestGetBundle_PermanentBackoffFail

pkg/cmd/attestation/api/client_test.go:291–304  ·  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

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

Callers

nothing calls this directly

Calls 4

getBundleMethod · 0.95
NewTestHandlerFunction · 0.92
NewImmutableSafeURLFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected