diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-03-08 20:25:37 -0700 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-03-08 20:40:48 -0700 |
commit | c551e45a4722f58dc4c19f9d1b80b0b8db3ad039 (patch) | |
tree | 93ac43914f9cd20c8eea13f18105e55026a7ea8d /functional_test.go | |
parent | Rename Transaction to Tx. (diff) | |
download | dedo-c551e45a4722f58dc4c19f9d1b80b0b8db3ad039.tar.gz dedo-c551e45a4722f58dc4c19f9d1b80b0b8db3ad039.tar.xz |
Consolidate Tx and RWTx.
Diffstat (limited to 'functional_test.go')
-rw-r--r-- | functional_test.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/functional_test.go b/functional_test.go index 20af8fc..a62e6a0 100644 --- a/functional_test.go +++ b/functional_test.go @@ -45,7 +45,7 @@ func TestParallelTxs(t *testing.T) { go func() { mutex.RLock() local := current - txn, err := db.Tx() + tx, err := db.Tx() mutex.RUnlock() if err == ErrDatabaseNotOpen { wg.Done() @@ -56,15 +56,15 @@ func TestParallelTxs(t *testing.T) { // Verify all data is in for local data list. for _, item := range local { - value := txn.Bucket("widgets").Get(item.Key) + value := tx.Bucket("widgets").Get(item.Key) if !assert.NoError(t, err) || !assert.Equal(t, value, item.Value) { - txn.Close() + tx.Rollback() wg.Done() t.FailNow() } } - txn.Close() + tx.Rollback() wg.Done() <-readers }() @@ -83,13 +83,13 @@ func TestParallelTxs(t *testing.T) { pending = pending[currentBatchSize:] // Start write transaction. - txn, err := db.RWTx() + tx, err := db.RWTx() if !assert.NoError(t, err) { t.FailNow() } // Insert whole batch. - b := txn.Bucket("widgets") + b := tx.Bucket("widgets") for _, item := range batchItems { err := b.Put(item.Key, item.Value) if !assert.NoError(t, err) { @@ -99,7 +99,7 @@ func TestParallelTxs(t *testing.T) { // Commit and update the current list. mutex.Lock() - err = txn.Commit() + err = tx.Commit() current = append(current, batchItems...) mutex.Unlock() if !assert.NoError(t, err) { |