aboutsummaryrefslogtreecommitdiff
path: root/db_test.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-05-27 12:08:33 -0600
committerBen Johnson <benbjohnson@yahoo.com>2014-05-27 12:08:33 -0600
commit93338e17eccebb077f96aabc7edc8f1c98c1b79d (patch)
treefe1fdb4aed24d100cac337e18afce207674fd65e /db_test.go
parentMerge branch 'master' of https://github.com/boltdb/bolt (diff)
parentRemove DB.Check(). Allow read-only Tx.Check(). (diff)
downloaddedo-93338e17eccebb077f96aabc7edc8f1c98c1b79d.tar.gz
dedo-93338e17eccebb077f96aabc7edc8f1c98c1b79d.tar.xz
Merge pull request #174 from benbjohnson/remove-db-check
Remove DB.Check(). Allow read-only Tx.Check().
Diffstat (limited to 'db_test.go')
-rw-r--r--db_test.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/db_test.go b/db_test.go
index b85f8cb..06accd3 100644
--- a/db_test.go
+++ b/db_test.go
@@ -53,12 +53,12 @@ func TestOpen_Check(t *testing.T) {
withTempPath(func(path string) {
db, err := Open(path, 0666)
assert.NoError(t, err)
- assert.NoError(t, db.Check())
+ assert.NoError(t, db.View(func(tx *Tx) error { return tx.Check() }))
db.Close()
db, err = Open(path, 0666)
assert.NoError(t, err)
- assert.NoError(t, db.Check())
+ assert.NoError(t, db.View(func(tx *Tx) error { return tx.Check() }))
db.Close()
})
}
@@ -463,7 +463,10 @@ func withOpenDB(fn func(*DB, string)) {
// mustCheck runs a consistency check on the database and panics if any errors are found.
func mustCheck(db *DB) {
- if err := db.Check(); err != nil {
+ err := db.Update(func(tx *Tx) error {
+ return tx.Check()
+ })
+ if err != nil {
// Copy db off first.
var path = tempfile()
db.View(func(tx *Tx) error { return tx.CopyFile(path, 0600) })