@@ -790,44 +790,41 @@ void CheckExecuteQueryWithSingleUseOptions(
790790}
791791
792792// / @test Verify the `ReadLockMode` option is sent in the RPC by creating a
793- // / situation where a transaction A performs a commit while a transaction B
794- // / performed one after tx A started.
793+ // / situation where a transaction "A" performs a commit while a transaction "B"
794+ // / performed one after tx "A" started.
795795TEST_F (ClientIntegrationTest, ReadLockModeOptionIsSent) {
796- if (UsingEmulator ()) {
797- GTEST_SKIP () << " Optimistic locks not supported by emulator" ;
798- }
799796 auto const singer_id = 101 ;
800797
801- auto mutation_helper = [singer_id](std::string new_name) {
798+ auto mutation_helper = [singer_id](const std::string & new_name) {
802799 return Mutations{MakeInsertOrUpdateMutation (
803800 " Singers" , {" SingerId" , " FirstName" }, singer_id, new_name)};
804801 };
805802
806- // initial insert
803+ // Initial insert
807804 auto insert = client_->Commit (mutation_helper (" InitialName" ));
808805 ASSERT_STATUS_OK (insert);
809806
810- // transaction A will do a DML after another transaction has executed DML
811- // If optimistic, we expect transaction A to be aborted
807+ // Transaction "A" will do a DML after another transaction has executed DML.
808+ // If optimistic, we expect transaction "A" to be aborted
812809 auto test_helper =
813810 [&mutation_helper, singer_id](
814811 Transaction::ReadLockMode read_lock_mode) -> StatusOr<CommitResult> {
815- // here we create tx A and confirm it can perform a read.
812+ // Here we create tx A and confirm it can perform a read.
816813 auto tx_a =
817814 MakeReadWriteTransaction (Transaction::ReadWriteOptions (read_lock_mode));
818815 auto tx_a_read_result = client_->Read (
819816 tx_a, " Singers" , KeySet ().AddKey (MakeKey (singer_id)), {" SingerId" });
820- for (auto row : StreamOf<std::tuple<std::int64_t >>(tx_a_read_result)) {
817+ for (const auto & row : StreamOf<std::tuple<std::int64_t >>(tx_a_read_result)) {
821818 EXPECT_STATUS_OK (row);
822819 }
823820
824- // now a separate tx b will perform a write operation before tx A is
821+ // Now a separate tx "B" will perform a write operation before tx "A" is
825822 // finished.
826823 auto tx_b = client_->Commit (mutation_helper (" FirstModifiedName" ));
827824 EXPECT_STATUS_OK (tx_b);
828825
829- // depending on the read lock mode, the result of the next write operation
830- // in tx A will vary.
826+ // Depending on the read lock mode, the result of the next write operation
827+ // in tx "A" will vary.
831828 return client_->Commit (tx_a, mutation_helper (" SecondModifiedName" ));
832829 };
833830
0 commit comments