MCPcopy
hub / github.com/perkeep/perkeep / TestReceiveCorrupt

Function TestReceiveCorrupt

pkg/blobserver/receive_test.go:61–73  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

59}
60
61func TestReceiveCorrupt(t *testing.T) {
62 sto := new(test.Fetcher)
63 data := []byte("some blob")
64 br := blob.RefFromBytes(data)
65 data[0] = 'X' // corrupt it
66 _, err := blobserver.Receive(ctxbg, sto, br, bytes.NewReader(data))
67 if err != blobserver.ErrCorruptBlob {
68 t.Errorf("Receive = %v; want ErrCorruptBlob", err)
69 }
70 if len(sto.BlobrefStrings()) > 0 {
71 t.Errorf("nothing should be stored. Got %q", sto.BlobrefStrings())
72 }
73}

Callers

nothing calls this directly

Calls 3

RefFromBytesFunction · 0.92
ReceiveFunction · 0.92
BlobrefStringsMethod · 0.80

Tested by

no test coverage detected