Documentation
¶
Overview ¶
Package testfault holds the failing fakes that handler tests share (decision 0015), so the error paths of streaming handlers are covered without real failures: a client that goes away mid-stream, and a blob store whose writes fail.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrDisconnected = fmt.Errorf("testfault: client disconnected: %w", io.ErrUnexpectedEOF)
ErrDisconnected is what a Disconnect body fails with. It wraps io.ErrUnexpectedEOF, which net/http's body reports when the client closes the connection before the length it declared.
Functions ¶
func Disconnect ¶
Disconnect returns body cut off after n bytes: it reads as body does until it has given n bytes, then fails every read with ErrDisconnected, as a request body does when its client goes away mid-stream. A body shorter than n ends as it would.
Types ¶
type Blobs ¶
Blobs is a blob store whose uploads fail: Begin fails BeginUpload, Append fails every Append once the upload has stored what it read, a write that fails part way through, and Commit fails Commit. A nil error passes the call to Store.
func (Blobs) BeginUpload ¶
BeginUpload starts an upload on Store whose Append and Commit fail as b says, or fails with Begin.