MCPcopy
hub / github.com/git-lfs/git-lfs / TestRetriableReaderDoesNotRewrap

Function TestRetriableReaderDoesNotRewrap

tools/iotools_test.go:48–65  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

46}
47
48func TestRetriableReaderDoesNotRewrap(t *testing.T) {
49 // expected is already "retriable", as would be the case if the
50 // underlying reader was a *RetriableReader itself.
51 expected := errors.NewRetriableError(errors.New("example error"))
52
53 r := tools.NewRetriableReader(&ErrReader{expected})
54
55 var buf [1]byte
56 n, err := r.Read(buf[:])
57
58 assert.Equal(t, 0, n)
59 // errors.NewRetriableError wraps the given error with the prefix
60 // message "LFS", so these two errors should be equal, indicating that
61 // the RetriableReader did not re-wrap the error it received.
62 assert.EqualError(t, err, expected.Error())
63 assert.True(t, errors.IsRetriableError(err))
64
65}
66
67// ErrReader implements io.Reader and only returns errors.
68type ErrReader struct {

Callers

nothing calls this directly

Calls 7

ReadMethod · 0.95
NewRetriableErrorFunction · 0.92
NewFunction · 0.92
NewRetriableReaderFunction · 0.92
IsRetriableErrorFunction · 0.92
ErrorMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected