2020#include " google/cloud/spanner/testing/database_integration_test.h"
2121#include " google/cloud/credentials.h"
2222#include " google/cloud/internal/random.h"
23- #include " google/cloud/log.h"
2423#include " google/cloud/testing_util/status_matchers.h"
2524#include < gmock/gmock.h>
2625#include < map>
@@ -780,8 +779,9 @@ TEST_F(ClientIntegrationTest, ReadLockModeOptionIsSent) {
780779 }
781780 auto const singer_id = 101 ;
782781
783- auto mutation_helper = [singer_id] (std::string new_name) {
784- return Mutations{MakeInsertOrUpdateMutation (" Singers" , {" SingerId" , " FirstName" }, singer_id, new_name)};
782+ auto mutation_helper = [singer_id](std::string new_name) {
783+ return Mutations{MakeInsertOrUpdateMutation (
784+ " Singers" , {" SingerId" , " FirstName" }, singer_id, new_name)};
785785 };
786786
787787 // initial insert
@@ -790,15 +790,20 @@ TEST_F(ClientIntegrationTest, ReadLockModeOptionIsSent) {
790790
791791 // transaction A will do a DML after another transaction has executed DML
792792 // If optimistic, we expect transaction A to be aborted
793- auto test_helper = [&mutation_helper, singer_id] (Transaction::ReadLockMode read_lock_mode) -> StatusOr<CommitResult> {
793+ auto test_helper =
794+ [&mutation_helper, singer_id](
795+ Transaction::ReadLockMode read_lock_mode) -> StatusOr<CommitResult> {
794796 // here we create tx A and confirm it can perform a read.
795- auto tx_a = MakeReadWriteTransaction (Transaction::ReadWriteOptions (read_lock_mode));
796- auto tx_a_read_result = client_->Read (tx_a, " Singers" , KeySet ().AddKey (MakeKey (singer_id)), {" SingerId" });
797+ auto tx_a =
798+ MakeReadWriteTransaction (Transaction::ReadWriteOptions (read_lock_mode));
799+ auto tx_a_read_result = client_->Read (
800+ tx_a, " Singers" , KeySet ().AddKey (MakeKey (singer_id)), {" SingerId" });
797801 for (auto row : StreamOf<std::tuple<std::int64_t >>(tx_a_read_result)) {
798802 EXPECT_STATUS_OK (row);
799803 }
800804
801- // now a separate tx b will perform a write operation before tx A is finished.
805+ // now a separate tx b will perform a write operation before tx A is
806+ // finished.
802807 auto tx_b = client_->Commit (mutation_helper (" FirstModifiedName" ));
803808 EXPECT_STATUS_OK (tx_b);
804809
@@ -808,7 +813,8 @@ TEST_F(ClientIntegrationTest, ReadLockModeOptionIsSent) {
808813 };
809814
810815 auto optimistic_result = test_helper (Transaction::ReadLockMode::kOptimistic );
811- auto pessimistic_result = test_helper (Transaction::ReadLockMode::kPessimistic );
816+ auto pessimistic_result =
817+ test_helper (Transaction::ReadLockMode::kPessimistic );
812818
813819 EXPECT_STATUS_OK (pessimistic_result);
814820 EXPECT_THAT (optimistic_result, StatusIs (StatusCode::kAborted ));
0 commit comments