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

Function TestGetBundle_PermanentBackoffFail

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

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