MCPcopy
hub / github.com/grafana/tempo / TestReadError

Function TestReadError

tempodb/backend/azure/azure_test.go:149–169  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

147}
148
149func TestReadError(t *testing.T) {
150 // confirm blobNotFoundError converts to ErrDoesNotExist
151 blobNotFoundError := blobStorageError(string(bloberror.BlobNotFound))
152 err := readError(blobNotFoundError)
153 require.Equal(t, backend.ErrDoesNotExist, err)
154
155 // wrap blob not found error and confirm it still converts to ErrDoesNotExist
156 wrappedBlobNotFoundError := fmt.Errorf("wrap: %w", blobNotFoundError)
157 err = readError(wrappedBlobNotFoundError)
158 require.Equal(t, backend.ErrDoesNotExist, err)
159
160 // rando error is not returned as ErrDoesNotExist
161 randoError := errors.New("blerg")
162 err = readError(randoError)
163 require.NotEqual(t, backend.ErrDoesNotExist, err)
164
165 // other azure error is not returned as ErrDoesNotExist
166 otherAzureError := blobStorageError(string(bloberror.InternalError))
167 err = readError(otherAzureError)
168 require.NotEqual(t, backend.ErrDoesNotExist, err)
169}
170
171func blobStorageError(serviceCode string) error {
172 resp := &http.Response{

Callers

nothing calls this directly

Calls 3

blobStorageErrorFunction · 0.85
readErrorFunction · 0.70
EqualMethod · 0.45

Tested by

no test coverage detected