MCPcopy
hub / github.com/perkeep/perkeep / newTempDiskpackedWithIndex

Function newTempDiskpackedWithIndex

pkg/blobserver/diskpacked/diskpacked_test.go:53–74  ·  view source on GitHub ↗
(t *testing.T, indexConf jsonconfig.Obj)

Source from the content-addressed store, hash-verified

51}
52
53func newTempDiskpackedWithIndex(t *testing.T, indexConf jsonconfig.Obj) blobserver.Storage {
54 restoreLogging := test.TLog(t)
55 dir, err := os.MkdirTemp("", "diskpacked-test")
56 if err != nil {
57 t.Fatal(err)
58 }
59 t.Logf("diskpacked test dir is %q", dir)
60 s, err := newStorage(dir, 1<<20, indexConf)
61 if err != nil {
62 t.Fatalf("newStorage: %v", err)
63 }
64 t.Cleanup(func() {
65 s.Close()
66 if env.IsDebug() {
67 t.Logf("CAMLI_DEBUG set, skipping cleanup of dir %q", dir)
68 } else {
69 os.RemoveAll(dir)
70 }
71 restoreLogging()
72 })
73 return s
74}
75
76func TestDiskpacked(t *testing.T) {
77 storagetest.Test(t, newTempDiskpacked)

Callers 2

newTempDiskpackedFunction · 0.85
newTempDiskpackedMemoryFunction · 0.85

Calls 7

TLogFunction · 0.92
IsDebugFunction · 0.92
newStorageFunction · 0.85
FatalMethod · 0.80
LogfMethod · 0.80
FatalfMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected