package bolt_test
import (
"context"
"testing"
"github.com/influxdata/influxdb/v2/kv"
platformtesting "github.com/influxdata/influxdb/v2/testing"
)
func initKVStore(f platformtesting.KVStoreFields, t *testing.T) (kv.Store, func()) {
s, closeFn, err := NewTestKVStore(t)
if err != nil {
t.Fatalf("failed to create new kv store: %v", err)
}
err = s.Update(context.Background(), func(tx kv.Tx) error {
b, err := tx.Bucket(f.Bucket)
return err
for _, p := range f.Pairs {
if err := b.Put(p.Key, p.Value); err != nil {
return nil
})
t.Fatalf("failed to put keys: %v", err)
return s, func() {
closeFn()
func TestKVStore(t *testing.T) {
platformtesting.KVStore(initKVStore, t)