@@ -3054,10 +3054,6 @@ TEST_F(DataConnectionTest, ExecuteQuerySuccessWithTransientErrors) {
30543054
30553055 auto stream = std::make_unique<MockExecuteQueryStream>();
30563056 EXPECT_CALL (*stream, Read)
3057- .WillOnce ([&](google::bigtable::v2::ExecuteQueryResponse* r) {
3058- *r->mutable_metadata () = pq_response.metadata ();
3059- return absl::nullopt ;
3060- })
30613057 .WillOnce ([&](google::bigtable::v2::ExecuteQueryResponse* r) {
30623058 MakeResponse (*r->mutable_results (), {" r1" , " v1" }, absl::nullopt ,
30633059 false );
@@ -3308,10 +3304,6 @@ TEST_F(DataConnectionTest, ExecuteQuerySuccessWithQueryPlanRefresh) {
33083304
33093305 auto stream = std::make_unique<MockExecuteQueryStream>();
33103306 EXPECT_CALL (*stream, Read)
3311- .WillOnce ([&](google::bigtable::v2::ExecuteQueryResponse* r) {
3312- *r->mutable_metadata () = refresh_pq_response.metadata ();
3313- return absl::nullopt ;
3314- })
33153307 .WillOnce ([&](google::bigtable::v2::ExecuteQueryResponse* r) {
33163308 MakeResponse (*r->mutable_results (), {" r1" , " v1" }, absl::nullopt ,
33173309 false );
@@ -3479,10 +3471,6 @@ TEST_F(DataConnectionTest, PrepareAndExecuteQuerySuccessWithQueryPlanRefresh) {
34793471
34803472 auto stream = std::make_unique<MockExecuteQueryStream>();
34813473 EXPECT_CALL (*stream, Read)
3482- .WillOnce ([&](ExecuteQueryResponse* r) {
3483- *r->mutable_metadata () = refresh_pq_response.metadata ();
3484- return absl::nullopt ;
3485- })
34863474 .WillOnce ([&](ExecuteQueryResponse* r) {
34873475 MakeResponse (*r->mutable_results (), {" r1" , " v1" }, absl::nullopt ,
34883476 false );
@@ -3649,10 +3637,6 @@ TEST_F(DataConnectionTest,
36493637
36503638 auto stream = std::make_unique<MockExecuteQueryStream>();
36513639 EXPECT_CALL (*stream, Read)
3652- .WillOnce ([&](ExecuteQueryResponse* r) {
3653- *r->mutable_metadata () = refresh_pq_response.metadata ();
3654- return absl::nullopt ;
3655- })
36563640 .WillOnce ([&](ExecuteQueryResponse* r) {
36573641 MakeResponse (*r->mutable_results (), {" r1" , " v1" }, absl::nullopt ,
36583642 false );
@@ -3726,44 +3710,29 @@ TEST_F(DataConnectionTest, ExecuteQueryFailureWithSchemaChange) {
37263710 kResultMetadataText , pq_response.mutable_metadata ()));
37273711 *pq_response.mutable_valid_until () = internal::ToProtoTimestamp (
37283712 std::chrono::system_clock::now () + std::chrono::seconds (3600 ));
3729-
3730- auto constexpr kExecuteQueryResultMetadataText = R"pb(
3731- proto_schema {
3732- columns {
3733- name: "row_key"
3734- type { string_type {} }
3735- }
3736- columns {
3737- name: "different_value"
3738- type { string_type {} }
3739- }
3740- }
3741- )pb" ;
37423713 v2::ExecuteQueryResponse eq_response;
37433714 ASSERT_TRUE (google::protobuf::TextFormat::ParseFromString (
3744- kExecuteQueryResultMetadataText , eq_response.mutable_metadata ()));
3715+ kResultMetadataText , eq_response.mutable_metadata ()));
37453716
37463717 auto refresh_fn = []() {
37473718 return make_ready_future (
37483719 StatusOr<google::bigtable::v2::PrepareQueryResponse>(
37493720 Status{StatusCode::kUnimplemented , " not implemented" }));
37503721 };
37513722 EXPECT_CALL (*mock, ExecuteQuery)
3752- .Times (3 )
3753- .WillRepeatedly (
3754- [&](auto , auto const &,
3755- google::bigtable::v2::ExecuteQueryRequest const & request) {
3756- EXPECT_EQ (request.app_profile_id (), kAppProfile );
3757- EXPECT_EQ (request.instance_name (),
3758- " projects/test-project/instances/test-instance" );
3759- auto stream = std::make_unique<MockExecuteQueryStream>();
3760- EXPECT_CALL (*stream, Read)
3761- .WillOnce ([&](google::bigtable::v2::ExecuteQueryResponse* r) {
3762- *r = eq_response;
3763- return absl::nullopt ;
3764- });
3765- return stream;
3766- });
3723+ .WillOnce ([&](auto , auto const &,
3724+ google::bigtable::v2::ExecuteQueryRequest const & request) {
3725+ EXPECT_EQ (request.app_profile_id (), kAppProfile );
3726+ EXPECT_EQ (request.instance_name (),
3727+ " projects/test-project/instances/test-instance" );
3728+ auto stream = std::make_unique<MockExecuteQueryStream>();
3729+ EXPECT_CALL (*stream, Read)
3730+ .WillOnce ([&](google::bigtable::v2::ExecuteQueryResponse* r) {
3731+ *r = eq_response;
3732+ return absl::nullopt ;
3733+ });
3734+ return stream;
3735+ });
37673736
37683737 auto conn = TestConnection (std::move (mock), std::move (factory));
37693738 internal::OptionsSpan span (CallOptions ());
@@ -3779,8 +3748,11 @@ TEST_F(DataConnectionTest, ExecuteQueryFailureWithSchemaChange) {
37793748 bigtable::ExecuteQueryParams params{std::move (bq)};
37803749 auto row_stream = conn->ExecuteQuery (std::move (params));
37813750 for (auto const & row : row_stream) {
3782- EXPECT_THAT (row,
3783- StatusIs (StatusCode::kAborted , HasSubstr (" Schema changed" )));
3751+ EXPECT_THAT (
3752+ row,
3753+ StatusIs (
3754+ StatusCode::kInternal ,
3755+ HasSubstr (" Expected results response, but received: METADATA" )));
37843756 }
37853757 fake_cq_impl->SimulateCompletion (false );
37863758}
0 commit comments