featurebase/index_internal_test.go
Matthew Jaffee 6cc5d198ee remove unused stuff and fix a bunch of random staticcheck issues
sorry... once I saw, I couldn't unsee
2022-02-07 15:10:10 -06:00

30 lines
630 B
Go

// Copyright 2021 Molecula Corp. All rights reserved.
package pilosa
import (
"testing"
"github.com/molecula/featurebase/v3/testhook"
)
// mustOpenIndex returns a new, opened index at a temporary path. Panic on error.
func mustOpenIndex(tb testing.TB, opt IndexOptions) *Index {
path, err := testhook.TempDirInDir(tb, *TempDir, "pilosa-index-")
if err != nil {
panic(err)
}
h := NewHolder(path, mustHolderConfig())
index, err := h.CreateIndex("i", opt)
testhook.Cleanup(tb, func() {
h.Close()
})
if err != nil {
panic(err)
}
index.keys = opt.Keys
index.trackExistence = opt.TrackExistence
return index
}