Merge pull request #690 from wpaulino/walletdb-revert-bolt-v1.3.4
walletdb: revert bolt v1.3.4
This commit is contained in:
commit
2fed914b79
6 changed files with 51 additions and 13 deletions
|
@ -9,7 +9,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/btcsuite/btcwallet/walletdb"
|
"github.com/btcsuite/btcwallet/walletdb"
|
||||||
"go.etcd.io/bbolt"
|
"github.com/coreos/bbolt"
|
||||||
)
|
)
|
||||||
|
|
||||||
// convertErr converts some bolt errors to the equivalent walletdb error.
|
// convertErr converts some bolt errors to the equivalent walletdb error.
|
||||||
|
|
|
@ -6,7 +6,9 @@ package bdb_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
@ -71,13 +73,19 @@ func TestCreateOpenFail(t *testing.T) {
|
||||||
|
|
||||||
// Ensure operations against a closed database return the expected
|
// Ensure operations against a closed database return the expected
|
||||||
// error.
|
// 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)
|
db, err := walletdb.Create(dbType, dbPath, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Create: unexpected error: %v", err)
|
t.Errorf("Create: unexpected error: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer os.Remove(dbPath)
|
|
||||||
db.Close()
|
db.Close()
|
||||||
|
|
||||||
wantErr = walletdb.ErrDbNotOpen
|
wantErr = walletdb.ErrDbNotOpen
|
||||||
|
@ -92,13 +100,19 @@ func TestCreateOpenFail(t *testing.T) {
|
||||||
// reopening the database.
|
// reopening the database.
|
||||||
func TestPersistence(t *testing.T) {
|
func TestPersistence(t *testing.T) {
|
||||||
// Create a new database to run tests against.
|
// 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)
|
db, err := walletdb.Create(dbType, dbPath, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Failed to create test database (%s) %v", dbType, err)
|
t.Errorf("Failed to create test database (%s) %v", dbType, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer os.Remove(dbPath)
|
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
// Create a namespace and put some values into it so they can be tested
|
// Create a namespace and put some values into it so they can be tested
|
||||||
|
|
|
@ -13,7 +13,9 @@
|
||||||
package bdb_test
|
package bdb_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/btcsuite/btcwallet/walletdb/walletdbtest"
|
"github.com/btcsuite/btcwallet/walletdb/walletdbtest"
|
||||||
|
@ -21,7 +23,14 @@ import (
|
||||||
|
|
||||||
// TestInterface performs all interfaces tests for this database driver.
|
// TestInterface performs all interfaces tests for this database driver.
|
||||||
func TestInterface(t *testing.T) {
|
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)
|
defer os.RemoveAll(dbPath)
|
||||||
walletdbtest.TestInterface(t, dbType, dbPath, true)
|
walletdbtest.TestInterface(t, dbType, dbPath, true)
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,9 @@ package walletdb_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/btcsuite/btcwallet/walletdb"
|
"github.com/btcsuite/btcwallet/walletdb"
|
||||||
|
@ -54,14 +56,20 @@ func TestAddDuplicateDriver(t *testing.T) {
|
||||||
"got %v, want %v", err, walletdb.ErrDbTypeRegistered)
|
"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)
|
db, err := walletdb.Create(dbType, dbPath, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to create database: %v", err)
|
t.Errorf("failed to create database: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
db.Close()
|
db.Close()
|
||||||
_ = os.Remove(dbPath)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,9 @@ go 1.12
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
|
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
|
||||||
|
github.com/coreos/bbolt v1.3.3
|
||||||
github.com/davecgh/go-spew v1.1.1
|
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
|
||||||
)
|
)
|
||||||
|
|
|
@ -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 h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo=
|
||||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
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 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
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.3 h1:MUGmc65QhB3pIlaQ5bB4LwqSj6GIonVJXpZiaKNyaKk=
|
||||||
go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
|
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 h1:LfCXLvNmTYH9kEmVgqbnsWfruoXZIrh4YBgqVHtDvw0=
|
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=
|
||||||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
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=
|
||||||
|
|
Loading…
Reference in a new issue