From 274b69453de0c3cc0e474805480e23b57f72d6c0 Mon Sep 17 00:00:00 2001 From: Andrew Sisley Date: Wed, 15 Feb 2023 18:00:20 -0500 Subject: [PATCH] PR FIXUP - TransactionID not TransactionId --- .../mutation/simple/mix/with_txn_test.go | 8 ++++---- tests/integration/test_case.go | 4 ++-- tests/integration/utils2.go | 16 ++++++++-------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/integration/mutation/simple/mix/with_txn_test.go b/tests/integration/mutation/simple/mix/with_txn_test.go index afaea855bb..ca7b6e995b 100644 --- a/tests/integration/mutation/simple/mix/with_txn_test.go +++ b/tests/integration/mutation/simple/mix/with_txn_test.go @@ -225,7 +225,7 @@ func TestMutationWithTxnDoesNotAllowUpdateInSecondTransactionUser(t *testing.T) }`, }, testUtils.TransactionRequest2{ - TransactionId: 0, + TransactionID: 0, Request: `mutation { update_user(data: "{\"age\": 28}") { _key @@ -242,7 +242,7 @@ func TestMutationWithTxnDoesNotAllowUpdateInSecondTransactionUser(t *testing.T) }, }, testUtils.TransactionRequest2{ - TransactionId: 1, + TransactionID: 1, Request: `mutation { update_user(data: "{\"age\": 29}") { _key @@ -259,10 +259,10 @@ func TestMutationWithTxnDoesNotAllowUpdateInSecondTransactionUser(t *testing.T) }, }, testUtils.TransactionCommit{ - TransactionId: 0, + TransactionID: 0, }, testUtils.TransactionCommit{ - TransactionId: 1, + TransactionID: 1, ExpectedError: "Transaction Conflict. Please retry", }, testUtils.Request{ diff --git a/tests/integration/test_case.go b/tests/integration/test_case.go index b6c589ed36..74970b6ee4 100644 --- a/tests/integration/test_case.go +++ b/tests/integration/test_case.go @@ -102,7 +102,7 @@ type Request struct { // provided. type TransactionRequest2 struct { // Used to identify the transaction for this to run against. - TransactionId int + TransactionID int // The request to run against the transaction. Request string @@ -120,7 +120,7 @@ type TransactionRequest2 struct { // TransactionCommit represents a commit request for a transaction of the given id. type TransactionCommit struct { // Used to identify the transaction to commit. - TransactionId int + TransactionID int // Any error expected from the action. Optional. // diff --git a/tests/integration/utils2.go b/tests/integration/utils2.go index 1523b16c63..61842156ac 100644 --- a/tests/integration/utils2.go +++ b/tests/integration/utils2.go @@ -545,12 +545,12 @@ func executeTransactionRequest( testCase TestCase, action TransactionRequest2, ) []datastore.Txn { - if action.TransactionId >= len(txns) { + if action.TransactionID >= len(txns) { // Extend the txn slice so this txn can fit and be accessed by TransactionId - txns = append(txns, make([]datastore.Txn, action.TransactionId-len(txns)+1)...) + txns = append(txns, make([]datastore.Txn, action.TransactionID-len(txns)+1)...) } - if txns[action.TransactionId] == nil { + if txns[action.TransactionID] == nil { // Create a new transaction if one does not already exist. txn, err := db.NewTxn(ctx, false) if AssertError(t, testCase.Description, err, action.ExpectedError) { @@ -558,10 +558,10 @@ func executeTransactionRequest( return nil } - txns[action.TransactionId] = txn + txns[action.TransactionID] = txn } - result := db.ExecTransactionalRequest(ctx, action.Request, txns[action.TransactionId]) + result := db.ExecTransactionalRequest(ctx, action.Request, txns[action.TransactionID]) expectedErrorRaised := assertRequestResults( ctx, t, @@ -576,7 +576,7 @@ func executeTransactionRequest( if expectedErrorRaised { // Make sure to discard the transaction before exit, else an unwanted error // may surface later (e.g. on database close). - txns[action.TransactionId].Discard(ctx) + txns[action.TransactionID].Discard(ctx) return nil } @@ -594,9 +594,9 @@ func commitTransaction( testCase TestCase, action TransactionCommit, ) { - err := txns[action.TransactionId].Commit(ctx) + err := txns[action.TransactionID].Commit(ctx) if err != nil { - txns[action.TransactionId].Discard(ctx) + txns[action.TransactionID].Discard(ctx) } expectedErrorRaised := AssertError(t, testCase.Description, err, action.ExpectedError)