Merge pull request #690 from wpaulino/walletdb-revert-bolt-v1.3.4

walletdb: revert bolt v1.3.4
This commit is contained in:
Olaoluwa Osuntokun 2020-04-03 15:01:46 -07:00 committed by GitHub
commit 2fed914b79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 51 additions and 13 deletions

View file

@ -9,7 +9,7 @@ import (
"os"
"github.com/btcsuite/btcwallet/walletdb"
"go.etcd.io/bbolt"
"github.com/coreos/bbolt"
)
// convertErr converts some bolt errors to the equivalent walletdb error.

View file

@ -6,7 +6,9 @@ package bdb_test
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"reflect"
"testing"
@ -71,13 +73,19 @@ func TestCreateOpenFail(t *testing.T) {
// Ensure operations against a closed database return the expected
// error.
dbPath := "createfail.db"
tempDir, err := ioutil.TempDir("", "createfail")
if err != nil {
t.Errorf("unable to create temp dir: %v", err)
return
}
defer os.Remove(tempDir)
dbPath := filepath.Join(tempDir, "db")
db, err := walletdb.Create(dbType, dbPath, true)
if err != nil {
t.Errorf("Create: unexpected error: %v", err)
return
}
defer os.Remove(dbPath)
db.Close()
wantErr = walletdb.ErrDbNotOpen
@ -92,13 +100,19 @@ func TestCreateOpenFail(t *testing.T) {
// reopening the database.
func TestPersistence(t *testing.T) {
// Create a new database to run tests against.
dbPath := "persistencetest.db"
tempDir, err := ioutil.TempDir("", "persistencetest")
if err != nil {
t.Errorf("unable to create temp dir: %v", err)
return
}
defer os.Remove(tempDir)
dbPath := filepath.Join(tempDir, "db")
db, err := walletdb.Create(dbType, dbPath, true)
if err != nil {
t.Errorf("Failed to create test database (%s) %v", dbType, err)
return
}
defer os.Remove(dbPath)
defer db.Close()
// Create a namespace and put some values into it so they can be tested

View file

@ -13,7 +13,9 @@
package bdb_test
import (
"io/ioutil"
"os"
"path/filepath"
"testing"
"github.com/btcsuite/btcwallet/walletdb/walletdbtest"
@ -21,7 +23,14 @@ import (
// TestInterface performs all interfaces tests for this database driver.
func TestInterface(t *testing.T) {
dbPath := "interfacetest.db"
tempDir, err := ioutil.TempDir("", "interfacetest")
if err != nil {
t.Errorf("unable to create temp dir: %v", err)
return
}
defer os.Remove(tempDir)
dbPath := filepath.Join(tempDir, "db")
defer os.RemoveAll(dbPath)
walletdbtest.TestInterface(t, dbType, dbPath, true)
}

View file

@ -6,7 +6,9 @@ package walletdb_test
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"testing"
"github.com/btcsuite/btcwallet/walletdb"
@ -54,14 +56,20 @@ func TestAddDuplicateDriver(t *testing.T) {
"got %v, want %v", err, walletdb.ErrDbTypeRegistered)
}
dbPath := "dupdrivertest.db"
tempDir, err := ioutil.TempDir("", "dupdrivertest")
if err != nil {
t.Errorf("unable to create temp dir: %v", err)
return
}
defer os.Remove(tempDir)
dbPath := filepath.Join(tempDir, "db")
db, err := walletdb.Create(dbType, dbPath, true)
if err != nil {
t.Errorf("failed to create database: %v", err)
return
}
db.Close()
_ = os.Remove(dbPath)
}

View file

@ -4,6 +4,9 @@ go 1.12
require (
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
github.com/coreos/bbolt v1.3.3
github.com/davecgh/go-spew v1.1.1
go.etcd.io/bbolt v1.3.4
go.etcd.io/bbolt v1.3.3 // indirect
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd // indirect
)

View file

@ -1,8 +1,12 @@
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo=
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
github.com/coreos/bbolt v1.3.3 h1:n6AiVyVRKQFNb6mJlwESEvvLoDyiTzXX7ORAUlkeBdY=
github.com/coreos/bbolt v1.3.3/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
go.etcd.io/bbolt v1.3.4 h1:hi1bXHMVrlQh6WwxAy+qZCV/SYIlqo+Ushwdpa4tAKg=
go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 h1:LfCXLvNmTYH9kEmVgqbnsWfruoXZIrh4YBgqVHtDvw0=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
go.etcd.io/bbolt v1.3.3 h1:MUGmc65QhB3pIlaQ5bB4LwqSj6GIonVJXpZiaKNyaKk=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd h1:DBH9mDw0zluJT/R+nGuV3jWFWLFaHyYZWD4tOT+cjn0=
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=