MCPcopy
hub / github.com/perkeep/perkeep / newTestStorage

Function newTestStorage

pkg/blobserver/diskpacked/stream_test.go:107–131  ·  view source on GitHub ↗
(t *testing.T, packs ...pack)

Source from the content-addressed store, hash-verified

105}
106
107func newTestStorage(t *testing.T, packs ...pack) (s *storage, clean func()) {
108 restoreLogging := test.TLog(t)
109 dir := t.TempDir()
110
111 for i, p := range packs {
112 writePack(t, dir, i, p)
113 }
114
115 ctx, cancel := context.WithCancel(context.Background())
116 err := Reindex(ctx, dir, true, nil)
117 cancel()
118 if err != nil {
119 t.Fatalf("Reindexing after writing pack files: %v", err)
120 }
121 s, err = newStorage(dir, 0, nil)
122 if err != nil {
123 t.Fatal(err)
124 }
125
126 clean = func() {
127 s.Close()
128 restoreLogging()
129 }
130 return s, clean
131}
132
133// It verifies the size and hash of each
134// before returning and fails the test if any of the checks fail. It

Callers 2

TestBasicStreamingFunction · 0.70
TestStreamMultiplePacksFunction · 0.70

Calls 7

TLogFunction · 0.92
writePackFunction · 0.85
newStorageFunction · 0.85
FatalMethod · 0.80
ReindexFunction · 0.70
FatalfMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected