Change storage to open-close bolt.db to hopefully avoid /tmp files
This commit is contained in:
@@ -369,13 +369,14 @@ func tempBoltDB(t *testing.T) (*BoltDB, func()) {
|
||||
bdb := NewBoltDB(f.Name())
|
||||
fillBoltDB(t, bdb)
|
||||
return bdb, func() {
|
||||
bdb.db.Close()
|
||||
os.Remove(f.Name())
|
||||
}
|
||||
}
|
||||
|
||||
func fillBoltDB(t *testing.T, bdb *BoltDB) {
|
||||
if err := bdb.db.Update(func(tx *bolt.Tx) error {
|
||||
db, _ := bdb.db(context.TODO())
|
||||
defer db.Close()
|
||||
if err := db.Update(func(tx *bolt.Tx) error {
|
||||
bucket, err := tx.CreateBucketIfNotExists([]byte(testNS))
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user