MCPcopy
hub / github.com/perkeep/perkeep / run

Method run

pkg/blobserver/sync_test.go:32–59  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

30}
31
32func (lt *lmdbTest) run(t *testing.T) {
33 srcBlobs := make(chan blob.SizedRef, 100)
34 destBlobs := make(chan blob.SizedRef, 100)
35 sendTestBlobs(srcBlobs, lt.src, 123)
36 destSize := uint32(123)
37 if lt.diffSize {
38 destSize = 567
39 }
40 sendTestBlobs(destBlobs, lt.dst, destSize)
41
42 missingc := make(chan blob.SizedRef)
43 var missing, mismatch []string
44 onMismatch := func(br blob.Ref) {
45 mismatch = append(mismatch, br.String())
46 }
47 go ListMissingDestinationBlobs(missingc, onMismatch, srcBlobs, destBlobs)
48 for sb := range missingc {
49 missing = append(missing, sb.Ref.String())
50 }
51 if got := strings.Join(missing, ","); got != lt.missing {
52 t.Errorf("For src %q and dest %q got missing %q; want %q",
53 lt.src, lt.dst, got, lt.missing)
54 }
55 if got := strings.Join(mismatch, ","); got != lt.mismatch {
56 t.Errorf("For src %q and dest %q got mismatched %q; want %q",
57 lt.src, lt.dst, got, lt.mismatch)
58 }
59}
60
61func sendTestBlobs(ch chan blob.SizedRef, list string, size uint32) {
62 defer close(ch)

Callers 1

Calls 3

sendTestBlobsFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected