aboutsummaryrefslogtreecommitdiff
path: root/db_test.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-05-28 10:46:21 -0600
committerBen Johnson <benbjohnson@yahoo.com>2014-05-28 10:46:21 -0600
commitb9b1bb5b292766d92b2867631942c28ac2e97af4 (patch)
treead956b5e92c9e371df3f10277126b6c5821ecd2e /db_test.go
parentMerge pull request #175 from benbjohnson/check-loop (diff)
parentAdd streaming check. (diff)
downloaddedo-b9b1bb5b292766d92b2867631942c28ac2e97af4.tar.gz
dedo-b9b1bb5b292766d92b2867631942c28ac2e97af4.tar.xz
Merge pull request #176 from benbjohnson/streaming-check
Add streaming check.
Diffstat (limited to 'db_test.go')
-rw-r--r--db_test.go15
1 files changed, 4 insertions, 11 deletions
diff --git a/db_test.go b/db_test.go
index 06accd3..e1c4aaa 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.View(func(tx *Tx) error { return tx.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.View(func(tx *Tx) error { return tx.Check() }))
+ assert.NoError(t, db.View(func(tx *Tx) error { return <-tx.Check() }))
db.Close()
})
}
@@ -464,20 +464,13 @@ 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) {
err := db.Update(func(tx *Tx) error {
- return tx.Check()
+ return <-tx.Check()
})
if err != nil {
// Copy db off first.
var path = tempfile()
db.View(func(tx *Tx) error { return tx.CopyFile(path, 0600) })
-
- if errors, ok := err.(ErrorList); ok {
- for _, err := range errors {
- warn(err)
- }
- }
- warn(err)
- panic("check failure: " + path)
+ panic("check failure: " + err.Error() + ": " + path)
}
}