From c551e45a4722f58dc4c19f9d1b80b0b8db3ad039 Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Sat, 8 Mar 2014 20:25:37 -0700 Subject: Consolidate Tx and RWTx. --- functional_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'functional_test.go') 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) { -- cgit v1.2.3