Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions store/boltdb/boltdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ func New(endpoints []string, options *store.Config) (store.Store, error) {
}

dir, _ := filepath.Split(endpoints[0])
if err = os.MkdirAll(dir, 0750); err != nil {
return nil, err
if dir != "" {
if err = os.MkdirAll(dir, 0750); err != nil {
return nil, err
}
}

if options.PersistConnection {
Expand Down
15 changes: 14 additions & 1 deletion store/boltdb/boltdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,24 @@ func TestConcurrentConnection(t *testing.T) {
_ = os.Remove("/tmp/__boltdbtest")
}

func TestBoldDBStore(t *testing.T) {
func TestBoltDBStore(t *testing.T) {
kv := makeBoltDBClient(t)

testutils.RunTestCommon(t, kv)
testutils.RunTestAtomic(t, kv)

_ = os.Remove("/tmp/not_exist_dir/__boltdbtest")
}

func TestRelativePathWithNoBeginningSlash(t *testing.T) {

_, err := libkv.NewStore(
store.BOLTDB,
[]string{"__boltdbtest"},
&store.Config{
Bucket: "boltDBTest",
},
)

assert.NoError(t, err)
}