forked from TrueCloudLab/neoneo-go
3b19b34122
Everything was wrong here, wrong file used, wrong cleanup procedure, the net result is this (and some failing tests from time to time): $ ls -l /tmp/test_bolt_db* | wc -l 30939
23 lines
494 B
Go
23 lines
494 B
Go
package storage
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func newBoltStoreForTesting(t *testing.T) Store {
|
|
testFileName := "test_bolt_db"
|
|
file, err := ioutil.TempFile("", testFileName)
|
|
t.Cleanup(func() {
|
|
err := os.RemoveAll(file.Name())
|
|
require.NoError(t, err)
|
|
})
|
|
require.NoError(t, err)
|
|
require.NoError(t, file.Close())
|
|
boltDBStore, err := NewBoltDBStore(BoltDBOptions{FilePath: file.Name()})
|
|
require.NoError(t, err)
|
|
return boltDBStore
|
|
}
|