Skip to content

Commit cf43048

Browse files
committed
clean up test
1 parent 140ceca commit cf43048

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

google/cloud/bigtable/tests/data_integration_test.cc

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
#include "google/cloud/bigtable/client.h"
16+
#include "google/cloud/bigtable/options.h"
1617
#include "google/cloud/bigtable/internal/defaults.h"
1718
#include "google/cloud/bigtable/retry_policy.h"
1819
#include "google/cloud/bigtable/testing/table_integration_test.h"
@@ -29,6 +30,9 @@ namespace bigtable {
2930
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
3031
namespace {
3132

33+
using ::google::cloud::bigtable::experimental::
34+
QueryPlanRefreshLimitedErrorCountRetryPolicy;
35+
using ::google::cloud::bigtable::experimental::QueryPlanRefreshRetryPolicyOption;
3236
using ::google::cloud::bigtable::testing::TableIntegrationTest;
3337
using ::google::cloud::bigtable::testing::TableTestEnvironment;
3438
using ::google::cloud::testing_util::chrono_literals::operator""_ms;
@@ -678,20 +682,22 @@ TEST(ConnectionRefresh, Frequent) {
678682

679683
TEST_P(DataIntegrationTest, ClientQueryTest) {
680684
auto const table_id = testing::TableTestEnvironment::table_id();
681-
auto table = Table(
682-
MakeDataConnection(
683-
Options{}
684-
.set<DataRetryPolicyOption>(
685-
DataLimitedErrorCountRetryPolicy(0).clone())
686-
.set<DataBackoffPolicyOption>(
687-
google::cloud::internal::ExponentialBackoffPolicy(ms(0),
688-
ms(0), 2.0)
689-
.clone())
690-
.set<bigtable::experimental::QueryPlanRefreshRetryPolicyOption>(
691-
bigtable::experimental::
692-
QueryPlanRefreshLimitedErrorCountRetryPolicy(0)
693-
.clone())),
694-
TableResource(project_id(), instance_id(), table_id));
685+
auto retry_policy_option = DataLimitedErrorCountRetryPolicy(0).clone();
686+
auto backoff_policy_option =
687+
google::cloud::internal::ExponentialBackoffPolicy(ms(0), ms(0), 2.0)
688+
.clone();
689+
auto query_refresh_option =
690+
bigtable::experimental::QueryPlanRefreshLimitedErrorCountRetryPolicy(0)
691+
.clone();
692+
auto opts =
693+
Options{}
694+
.set<DataRetryPolicyOption>(std::move(retry_policy_option))
695+
.set<DataBackoffPolicyOption>(std::move(backoff_policy_option))
696+
.set<bigtable::experimental::QueryPlanRefreshRetryPolicyOption>(
697+
std::move(query_refresh_option));
698+
auto connection = google::cloud::bigtable::MakeDataConnection(opts);
699+
auto table =
700+
Table(connection, TableResource(project_id(), instance_id(), table_id));
695701
std::string const row_key = "row-key-for-client-query-test";
696702
std::string const family = kFamily4;
697703
std::string const column1 = "c1";
@@ -704,7 +710,7 @@ TEST_P(DataIntegrationTest, ClientQueryTest) {
704710
{row_key, family, column2, 0, value2},
705711
};
706712
BulkApply(table, created);
707-
auto client = Client(table.connection());
713+
auto client = Client(table.connection(), opts);
708714
std::vector<std::string> full_table_path =
709715
absl::StrSplit(table.table_name(), '/');
710716
auto table_name = full_table_path.back();
@@ -728,7 +734,7 @@ TEST_P(DataIntegrationTest, ClientQueryTest) {
728734
ASSERT_EQ(rows.size(), 1);
729735
ASSERT_STATUS_OK(rows[0]);
730736
auto const& row1 = *rows[0];
731-
EXPECT_THAT(row1.columns().at(0), "c0");
737+
ASSERT_EQ(row1.columns().at(0), "c0");
732738
}
733739

734740
// TODO(#8800) - remove after deprecation is complete

0 commit comments

Comments
 (0)