| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5af3cb7 commit b756cf5
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,6 +13,7 @@ | |||
| 13 | 13 | # limitations under the License. | |
| 14 | 14 | ||
| 15 | 15 | load(":spanner_client_integration_tests.bzl", "spanner_client_integration_tests") | |
| 16 | + load(":spanner_client_session_mode_sensitive_integration_tests.bzl", "spanner_client_session_mode_sensitive_integration_tests") | ||
| 16 | 17 | ||
| 17 | 18 | package(default_visibility = ["//visibility:private"]) | |
| 18 | 19 | ||
@@ -37,3 +38,30 @@ licenses(["notice"]) # Apache 2.0 | |||
| 37 | 38 | "@com_google_googletest//:gtest_main", | |
| 38 | 39 | ], | |
| 39 | 40 | ) for test in spanner_client_integration_tests] | |
| 41 | + | ||
| 42 | + VARIATIONS = { | ||
| 43 | + "session-pool": {"GOOGLE_CLOUD_CPP_SPANNER_TESTING_SESSION_MODE": "pool"}, | ||
| 44 | + "session-multiplexed": {"GOOGLE_CLOUD_CPP_SPANNER_TESTING_SESSION_MODE": "multiplexed"}, | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + [cc_test( | ||
| 48 | + name = test.replace("/", "_").replace(".cc", "") + "-" + v_label, | ||
| 49 | + timeout = "eternal", | ||
| 50 | + srcs = [test], | ||
| 51 | + env = v_env, | ||
| 52 | + tags = [ | ||
| 53 | + "integration-test", | ||
| 54 | + "integration-test-" + v_label, | ||
| 55 | + ], | ||
| 56 | + deps = [ | ||
| 57 | + "//:common", | ||
| 58 | + "//:spanner", | ||
| 59 | + "//:spanner_mocks", | ||
| 60 | + "//google/cloud/spanner:spanner_client_testing_private", | ||
| 61 | + "//google/cloud/testing_util:google_cloud_cpp_testing_grpc_private", | ||
| 62 | + "//google/cloud/testing_util:google_cloud_cpp_testing_private", | ||
| 63 | + "//protos:system_includes", | ||
| 64 | + "//protos/google/cloud/spanner/testing:singer_cc_proto", | ||
| 65 | + "@com_google_googletest//:gtest_main", | ||
| 66 | + ], | ||
| 67 | + ) for test in spanner_client_session_mode_sensitive_integration_tests for v_label, v_env in VARIATIONS.items()] | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,23 +25,31 @@ function (spanner_client_define_integration_tests) | |||
| 25 | 25 | # cmake-format: sort | |
| 26 | 26 | backup_extra_integration_test.cc | |
| 27 | 27 | backup_integration_test.cc | |
| 28 | - client_integration_test.cc | ||
| 29 | 28 | client_stress_test.cc | |
| 30 | 29 | data_types_integration_test.cc | |
| 31 | 30 | database_admin_integration_test.cc | |
| 32 | 31 | instance_admin_integration_test.cc | |
| 33 | 32 | session_pool_integration_test.cc) | |
| 34 | 33 | ||
| 34 | + set(spanner_client_session_mode_sensitive_integration_tests | ||
| 35 | + # cmake-format: sort | ||
| 36 | + client_integration_test.cc) | ||
| 37 | + | ||
| 35 | 38 | # Export the list of unit tests to a .bzl file so we do not need to maintain | |
| 36 | 39 | # the list in two places. | |
| 37 | 40 | export_list_to_bazel("spanner_client_integration_tests.bzl" | |
| 38 | 41 | "spanner_client_integration_tests" YEAR "2019") | |
| 42 | + export_list_to_bazel( | ||
| 43 | + "spanner_client_session_mode_sensitive_integration_tests.bzl" | ||
| 44 | + "spanner_client_session_mode_sensitive_integration_tests" YEAR "2025") | ||
| 39 | 45 | ||
| 40 | 46 | # Create a custom target so we can say "build all the tests" | |
| 41 | 47 | add_custom_target(spanner-client-integration-tests) | |
| 42 | 48 | ||
| 43 | 49 | # Generate a target for each unit test. | |
| 44 | - foreach (fname ${spanner_client_integration_tests}) | ||
| 50 | + foreach (fname IN | ||
| 51 | + LISTS ${spanner_client_integration_tests} | ||
| 52 | + ${spanner_client_session_mode_sensitive_integration_tests}) | ||
| 45 | 53 | google_cloud_cpp_add_executable(target "spanner" "${fname}") | |
| 46 | 54 | target_link_libraries( | |
| 47 | 55 | ${target} | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,6 +18,7 @@ | |||
| 18 | 18 | #include "google/cloud/spanner/mutations.h" | |
| 19 | 19 | #include "google/cloud/spanner/testing/database_integration_test.h" | |
| 20 | 20 | #include "google/cloud/credentials.h" | |
| 21 | + #include "google/cloud/internal/getenv.h" | ||
| 21 | 22 | #include "google/cloud/internal/random.h" | |
| 22 | 23 | #include "google/cloud/testing_util/status_matchers.h" | |
| 23 | 24 | #include <gmock/gmock.h> | |
@@ -49,9 +50,15 @@ class ClientIntegrationTest : public spanner_testing::DatabaseIntegrationTest { | |||
| 49 | 50 | protected: | |
| 50 | 51 | static void SetUpTestSuite() { | |
| 51 | 52 | spanner_testing::DatabaseIntegrationTest::SetUpTestSuite(); | |
| 52 | - client_ = std::make_unique<Client>(MakeConnection( | ||
| 53 | - GetDatabase(), | ||
| 54 | - Options{}.set<GrpcCompressionAlgorithmOption>(GRPC_COMPRESS_GZIP))); | ||
| 53 | + auto options = | ||
| 54 | + Options{}.set<GrpcCompressionAlgorithmOption>(GRPC_COMPRESS_GZIP); | ||
| 55 | + auto session_mode = | ||
| 56 | + internal::GetEnv("GOOGLE_CLOUD_CPP_SPANNER_TESTING_SESSION_MODE"); | ||
| 57 | + if (session_mode.has_value() && *session_mode == "multiplexed") { | ||
| 58 | + options.set<spanner_experimental::EnableMultiplexedSessionOption>({}); | ||
| 59 | + } | ||
| 60 | + client_ = std::make_unique<Client>( | ||
| 61 | + MakeConnection(GetDatabase(), std::move(options))); | ||
| 55 | 62 | } | |
| 56 | 63 | ||
| 57 | 64 | void SetUp() override { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,7 +19,6 @@ | |||
| 19 | 19 | spanner_client_integration_tests = [ | |
| 20 | 20 | "backup_extra_integration_test.cc", | |
| 21 | 21 | "backup_integration_test.cc", | |
| 22 | - "client_integration_test.cc", | ||
| 23 | 22 | "client_stress_test.cc", | |
| 24 | 23 | "data_types_integration_test.cc", | |
| 25 | 24 | "database_admin_integration_test.cc", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,21 @@ | |||
| 1 | + # Copyright 2025 Google LLC | ||
| 2 | + # | ||
| 3 | + # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 4 | + # you may not use this file except in compliance with the License. | ||
| 5 | + # You may obtain a copy of the License at | ||
| 6 | + # | ||
| 7 | + # https://www.apache.org/licenses/LICENSE-2.0 | ||
| 8 | + # | ||
| 9 | + # Unless required by applicable law or agreed to in writing, software | ||
| 10 | + # distributed under the License is distributed on an "AS IS" BASIS, | ||
| 11 | + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 12 | + # See the License for the specific language governing permissions and | ||
| 13 | + # limitations under the License. | ||
| 14 | + # | ||
| 15 | + # DO NOT EDIT -- GENERATED BY CMake -- Change the CMakeLists.txt file if needed | ||
| 16 | + | ||
| 17 | + """Automatically generated unit tests list - DO NOT EDIT.""" | ||
| 18 | + | ||
| 19 | + spanner_client_session_mode_sensitive_integration_tests = [ | ||
| 20 | + "client_integration_test.cc", | ||
| 21 | + ] | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -252,7 +252,8 @@ using SessionPoolOptionList = OptionList< | |||
| 252 | 252 | RouteToLeaderOption, SessionCreatorRoleOption, SessionPoolMinSessionsOption, | |
| 253 | 253 | SessionPoolMaxSessionsPerChannelOption, SessionPoolMaxIdleSessionsOption, | |
| 254 | 254 | SessionPoolActionOnExhaustionOption, SessionPoolKeepAliveIntervalOption, | |
| 255 | - SessionPoolLabelsOption>; | ||
| 255 | + SessionPoolLabelsOption, | ||
| 256 | + spanner_experimental::EnableMultiplexedSessionOption>; | ||
| 256 | 257 | ||
| 257 | 258 | /** | |
| 258 | 259 | * Option for `google::cloud::Options` to set the optimizer version used in an | |
| Back | FazBrowse Home | New Git URL |
0 commit comments