diff --git a/google/cloud/internal/external_account_integration_test.cc b/google/cloud/internal/external_account_integration_test.cc index 663079b222d03..9df38919aa3ad 100644 --- a/google/cloud/internal/external_account_integration_test.cc +++ b/google/cloud/internal/external_account_integration_test.cc @@ -31,9 +31,9 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN namespace { using ::google::cloud::internal::GetEnv; +#ifdef GOOGLE_CLOUD_CPP_TESTING_ENABLE_RAB using ::google::cloud::testing_util::IsOkAndHolds; - -auto constexpr kEndpointThatUsesRAB = "storage.googleapis.com"; +#endif MATCHER_P(NonEmptyHttpHeaderNameIs, header_name, "has non-empty header named") { return header_name == arg.name() && !arg.EmptyValues(); @@ -150,6 +150,8 @@ TEST(ExternalAccountIntegrationTest, ExternalAccountCredentials) { } TEST(ExternalAccountIntegrationTest, RABExternalAccountCredentials) { +#ifdef GOOGLE_CLOUD_CPP_TESTING_ENABLE_RAB + auto constexpr kEndpointThatUsesRAB = "storage.googleapis.com"; auto contents = GetExternalAccountCredentialsContents(); if (contents.empty()) GTEST_SKIP(); @@ -173,6 +175,9 @@ TEST(ExternalAccountIntegrationTest, RABExternalAccountCredentials) { EXPECT_THAT(headers, IsOkAndHolds(::testing::Contains(NonEmptyHttpHeaderNameIs( std::string{"x-allowed-locations"})))); +#else + GTEST_SKIP() << "RAB testing is not enabled"; +#endif } // namespace GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END } // namespace oauth2_internal