From 2626f12add76ec0b056c3f67642ce9dba18f3f0b Mon Sep 17 00:00:00 2001 From: Larry Osterman Date: Mon, 23 Jun 2025 14:34:53 -0700 Subject: [PATCH] Temporarily disable Mac azuresdkforcpp tests (#6636) * Temporarily disable Mac azuresdkforcpp tests --- .../test/ut/curl_connection_pool_test.cpp | 9 +- .../azure-core/test/ut/curl_options_test.cpp | 31 +++++-- .../test/ut/transport_adapter_base_test.cpp | 89 ++++++++++++++++++- .../test/ut/transport_adapter_base_test.hpp | 5 ++ .../test/ut/transport_policy_options.cpp | 40 +++++---- 5 files changed, 148 insertions(+), 26 deletions(-) diff --git a/sdk/core/azure-core/test/ut/curl_connection_pool_test.cpp b/sdk/core/azure-core/test/ut/curl_connection_pool_test.cpp index 8902a982f..281abaedf 100644 --- a/sdk/core/azure-core/test/ut/curl_connection_pool_test.cpp +++ b/sdk/core/azure-core/test/ut/curl_connection_pool_test.cpp @@ -41,7 +41,6 @@ namespace Azure { namespace Core { namespace Test { /*********************** Unique Tests for Libcurl ********************************/ #if defined(BUILD_CURL_HTTP_TRANSPORT_ADAPTER) - TEST(CurlConnectionPool, connectionPoolTest) { { @@ -607,7 +606,11 @@ namespace Azure { namespace Core { namespace Test { } } +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST(CurlConnectionPool, DISABLED_forceConnectionClosed) +#else TEST(CurlConnectionPool, forceConnectionClosed) +#endif { Azure::Core::Http::Request req( Azure::Core::Http::HttpMethod::Get, Azure::Core::Url(AzureSdkHttpbinServer::Status(101))); @@ -630,7 +633,11 @@ namespace Azure { namespace Core { namespace Test { } } +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST(CurlConnectionPool, DISABLED_connectionClose) +#else TEST(CurlConnectionPool, connectionClose) +#endif { /// When getting the header connection: close from an HTTP response, the connection should not /// be moved back to the pool. diff --git a/sdk/core/azure-core/test/ut/curl_options_test.cpp b/sdk/core/azure-core/test/ut/curl_options_test.cpp index d7dfa778f..069061305 100644 --- a/sdk/core/azure-core/test/ut/curl_options_test.cpp +++ b/sdk/core/azure-core/test/ut/curl_options_test.cpp @@ -60,7 +60,11 @@ namespace Azure { namespace Core { namespace Test { } /******************************* SSL options. ************************/ - TEST(CurlTransportOptions, noRevoke) +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST(CurlConnectionPool, DISABLED_noRevoke) +#else + TEST(CurlConnectionPool, noRevoke) +#endif { Azure::Core::Http::CurlTransportOptions curlOptions; curlOptions.SslOptions.EnableCertificateRevocationListCheck = true; @@ -197,7 +201,11 @@ namespace Azure { namespace Core { namespace Test { } */ - TEST(CurlTransportOptions, sslVerifyOff) +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST(CurlConnectionPool, DISABLED_sslVerifyOff) +#else + TEST(CurlConnectionPool, sslVerifyOff) +#endif { Azure::Core::Http::CurlTransportOptions curlOptions; // If ssl verify is not disabled, this test would fail because the caInfo is not OK @@ -295,7 +303,11 @@ namespace Azure { namespace Core { namespace Test { #endif } - TEST(CurlTransportOptions, httpsDefault) +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST(CurlConnectionPool, DISABLED_httpsDefault) +#else + TEST(CurlConnectionPool, httpsDefault) +#endif { auto transportAdapter = std::make_shared(); Azure::Core::Http::Policies::TransportOptions options; @@ -327,7 +339,11 @@ namespace Azure { namespace Core { namespace Test { .ConnectionPoolIndex.clear()); } - TEST(CurlTransportOptions, disableKeepAlive) +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST(CurlConnectionPool, DISABLED_disableKeepAlive) +#else + TEST(CurlConnectionPool, disableKeepAlive) +#endif { Azure::Core::Http::CurlTransportOptions curlOptions; curlOptions.HttpKeepAlive = false; @@ -365,7 +381,11 @@ namespace Azure { namespace Core { namespace Test { 0); } - TEST(CurlTransportOptions, disableSslCaching) +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST(CurlConnectionPool, DISABLED_disableSslCaching) +#else + TEST(CurlConnectionPool, disableSslCaching) +#endif { Azure::Core::Http::CurlTransportOptions curlOptions; curlOptions.EnableCurlSslCaching = false; @@ -401,5 +421,4 @@ namespace Azure { namespace Core { namespace Test { EXPECT_NO_THROW(Azure::Core::Http::_detail::CurlConnectionPool::g_curlConnectionPool .ConnectionPoolIndex.clear()); } - }}} // namespace Azure::Core::Test diff --git a/sdk/core/azure-core/test/ut/transport_adapter_base_test.cpp b/sdk/core/azure-core/test/ut/transport_adapter_base_test.cpp index a7a2feae6..776e4d055 100644 --- a/sdk/core/azure-core/test/ut/transport_adapter_base_test.cpp +++ b/sdk/core/azure-core/test/ut/transport_adapter_base_test.cpp @@ -17,7 +17,11 @@ namespace Azure { namespace Core { namespace Test { using namespace Azure::Core::Json::_internal; +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_P(TransportAdapter, DISABLED_get) +#else TEST_P(TransportAdapter, get) +#endif { Azure::Core::Url host(AzureSdkHttpbinServer::Get()); @@ -42,7 +46,11 @@ namespace Azure { namespace Core { namespace Test { EXPECT_EQ(jsonBody["headers"]["123"].get(), std::string("456")); } +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_P(TransportAdapter, DISABLED_get204) +#else TEST_P(TransportAdapter, get204) +#endif { Azure::Core::Url host("http://mt3.google.com/generate_204"); @@ -63,7 +71,11 @@ namespace Azure { namespace Core { namespace Test { CheckBodyFromBuffer(*response, expectedResponseBodySize); } +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_P(TransportAdapter, DISABLED_getLoop) +#else TEST_P(TransportAdapter, getLoop) +#endif { Azure::Core::Url host(AzureSdkHttpbinServer::Get()); @@ -79,7 +91,11 @@ namespace Azure { namespace Core { namespace Test { } } +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_P(TransportAdapter, DISABLED_head) +#else TEST_P(TransportAdapter, head) +#endif { Azure::Core::Url host(AzureSdkHttpbinServer::Get()); auto expectedResponseBodySize = 0; @@ -94,7 +110,11 @@ namespace Azure { namespace Core { namespace Test { EXPECT_GT(contentLengthHeader, 0); } +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_P(TransportAdapter, DISABLED_put) +#else TEST_P(TransportAdapter, put) +#endif { Azure::Core::Url host(AzureSdkHttpbinServer::Put()); @@ -117,7 +137,11 @@ namespace Azure { namespace Core { namespace Test { EXPECT_EQ(responseJson["data"].get(), bodyAsString); } +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_P(TransportAdapter, DISABLED_deleteRequest) +#else TEST_P(TransportAdapter, deleteRequest) +#endif { Azure::Core::Url host(AzureSdkHttpbinServer::Delete()); @@ -133,7 +157,11 @@ namespace Azure { namespace Core { namespace Test { CheckBodyFromBuffer(*response, expectedResponseBodySize); } +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_P(TransportAdapter, DISABLED_patch) +#else TEST_P(TransportAdapter, patch) +#endif { Azure::Core::Url host(AzureSdkHttpbinServer::Patch()); @@ -149,7 +177,11 @@ namespace Azure { namespace Core { namespace Test { CheckBodyFromBuffer(*response, expectedResponseBodySize); } +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_P(TransportAdapter, DISABLED_getChunk) +#else TEST_P(TransportAdapter, getChunk) +#endif { Azure::Core::Url host("http://anglesharp.azurewebsites.net/Chunked"); auto expectedResponseBodySize = -1; // chunked will return unknown body length @@ -167,7 +199,11 @@ namespace Azure { namespace Core { namespace Test { CheckBodyFromBuffer(*response, expectedResponseBodySize, expectedChunkResponse); } +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_P(TransportAdapter, DISABLED_putErrorResponse) +#else TEST_P(TransportAdapter, putErrorResponse) +#endif { Azure::Core::Url host(AzureSdkHttpbinServer::Get()); @@ -188,7 +224,11 @@ namespace Azure { namespace Core { namespace Test { // ***Same tests but getting stream to pull from socket, simulating the Download Op // ********************** +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_P(TransportAdapter, DISABLED_getWithStream) +#else TEST_P(TransportAdapter, getWithStream) +#endif { Azure::Core::Url host(AzureSdkHttpbinServer::Get()); @@ -213,7 +253,11 @@ namespace Azure { namespace Core { namespace Test { EXPECT_EQ(jsonBody["headers"]["123"].get(), std::string("456")); } +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_P(TransportAdapter, DISABLED_getLoopWithStream) +#else TEST_P(TransportAdapter, getLoopWithStream) +#endif { Azure::Core::Url host(AzureSdkHttpbinServer::Get()); @@ -229,7 +273,11 @@ namespace Azure { namespace Core { namespace Test { } } +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_P(TransportAdapter, DISABLED_headWitHStream) +#else TEST_P(TransportAdapter, headWithStream) +#endif { Azure::Core::Url host(AzureSdkHttpbinServer::Get()); auto expectedResponseBodySize = 0; @@ -244,7 +292,11 @@ namespace Azure { namespace Core { namespace Test { EXPECT_GT(contentLengthHeader, 0); } +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_P(TransportAdapter, DISABLED_putWithStream) +#else TEST_P(TransportAdapter, putWithStream) +#endif { Azure::Core::Url host(AzureSdkHttpbinServer::Put()); @@ -260,7 +312,11 @@ namespace Azure { namespace Core { namespace Test { CheckBodyFromStream(*response, expectedResponseBodySize); } +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_P(TransportAdapter, DISABLED_deleteRequestWithStream) +#else TEST_P(TransportAdapter, deleteRequestWithStream) +#endif { Azure::Core::Url host(AzureSdkHttpbinServer::Delete()); @@ -276,7 +332,11 @@ namespace Azure { namespace Core { namespace Test { CheckBodyFromStream(*response, expectedResponseBodySize); } +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_P(TransportAdapter, DISABLED_patchWithStream) +#else TEST_P(TransportAdapter, patchWithStream) +#endif { Azure::Core::Url host(AzureSdkHttpbinServer::Patch()); @@ -313,7 +373,11 @@ namespace Azure { namespace Core { namespace Test { CheckBodyFromStream(*response, expectedResponseBodySize, expectedChunkResponse); } +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_P(TransportAdapter, DISABLED_createResponseT) +#else TEST_P(TransportAdapter, createResponseT) +#endif { Azure::Core::Url host(AzureSdkHttpbinServer::Get()); std::string expectedType("This is the Response Type"); @@ -338,7 +402,11 @@ namespace Azure { namespace Core { namespace Test { EXPECT_STREQ(result.data(), std::string("").data()); } +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_P(TransportAdapter, DISABLED_customSizePut) +#else TEST_P(TransportAdapter, customSizePut) +#endif { Azure::Core::Url host(AzureSdkHttpbinServer::Put()); @@ -356,7 +424,11 @@ namespace Azure { namespace Core { namespace Test { } } +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_P(TransportAdapter, DISABLED_putWithStreamOnFail) +#else TEST_P(TransportAdapter, putWithStreamOnFail) +#endif { // point to bad address pah to generate server MethodNotAllowed error Azure::Core::Url host(AzureSdkHttpbinServer::Get()); @@ -399,7 +471,11 @@ namespace Azure { namespace Core { namespace Test { t1.join(); } +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_P(TransportAdapter, DISABLED_redirectsNotFollowed) +#else TEST_P(TransportAdapter, redirectsNotFollowed) +#endif { // We don't expect the transport adapter to follow redirects automatically to this url. std::string redirectToUrl = AzureSdkHttpbinServer::ResponseHeaders("foo=bar"); @@ -548,7 +624,11 @@ namespace Azure { namespace Core { namespace Test { } #endif +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_P(TransportAdapter, DISABLED_SizePutFromFile) +#else TEST_P(TransportAdapter, SizePutFromFile) +#endif { Azure::Core::Url host(AzureSdkHttpbinServer::Put()); std::string testDataPath(AZURE_TEST_DATA_PATH); @@ -573,7 +653,11 @@ namespace Azure { namespace Core { namespace Test { } } +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_P(TransportAdapter, DISABLED_SizePutFromFileDefault) +#else TEST_P(TransportAdapter, SizePutFromFileDefault) +#endif { Azure::Core::Url host(AzureSdkHttpbinServer::Put()); std::string testDataPath(AZURE_TEST_DATA_PATH); @@ -599,7 +683,11 @@ namespace Azure { namespace Core { namespace Test { } } +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_P(TransportAdapter, DISABLED_SizePutFromFileBiggerPage) +#else TEST_P(TransportAdapter, SizePutFromFileBiggerPage) +#endif { Azure::Core::Url host(AzureSdkHttpbinServer::Put()); std::string testDataPath(AZURE_TEST_DATA_PATH); @@ -683,5 +771,4 @@ namespace Azure { namespace Core { namespace Test { EXPECT_STREQ(expectedBody.data(), bodyString.data()); } } - }}} // namespace Azure::Core::Test diff --git a/sdk/core/azure-core/test/ut/transport_adapter_base_test.hpp b/sdk/core/azure-core/test/ut/transport_adapter_base_test.hpp index a7d8cab89..586ca1180 100644 --- a/sdk/core/azure-core/test/ut/transport_adapter_base_test.hpp +++ b/sdk/core/azure-core/test/ut/transport_adapter_base_test.hpp @@ -12,12 +12,17 @@ #include #include #include +#include #include #include #include +#if defined(AZ_PLATFORM_MAC) +#define _azure_DISABLE_HTTP_BIN_TESTS 1 +#endif + namespace Azure { namespace Core { namespace Test { namespace _detail { diff --git a/sdk/core/azure-core/test/ut/transport_policy_options.cpp b/sdk/core/azure-core/test/ut/transport_policy_options.cpp index 5a8050ffd..fa44f63f9 100644 --- a/sdk/core/azure-core/test/ut/transport_policy_options.cpp +++ b/sdk/core/azure-core/test/ut/transport_policy_options.cpp @@ -13,6 +13,7 @@ #include "azure/core/internal/json/json.hpp" #include "azure/core/platform.hpp" #include "azure/core/response.hpp" +#include "transport_adapter_base_test.hpp" #include #include @@ -23,10 +24,6 @@ using namespace std::chrono_literals; namespace Azure { namespace Core { namespace Test { - namespace { - constexpr static const char AzureSdkHttpbinServerSchema[] = "https"; - constexpr static const char AzureSdkHttpbinHost[] = "azuresdkforcpp.azurewebsites.net"; - } // namespace class TransportAdapterOptions : public ::testing::Test { public: @@ -34,36 +31,39 @@ namespace Azure { namespace Core { namespace Test { { inline static std::string Get() { - return std::string(AzureSdkHttpbinServerSchema) + "://" + std::string(AzureSdkHttpbinHost) - + "/get"; + return std::string(_detail::AzureSdkHttpbinServerSchema) + "://" + + std::string(_detail::AzureSdkHttpbinServer) + "/get"; } inline static std::string Headers() { - return std::string(AzureSdkHttpbinServerSchema) + "://" + std::string(AzureSdkHttpbinHost) - + "/headers"; + return std::string(_detail::AzureSdkHttpbinServerSchema) + "://" + + std::string(_detail::AzureSdkHttpbinServer) + "/headers"; } inline static std::string WithPort() { - return std::string(AzureSdkHttpbinServerSchema) + "://" + std::string(AzureSdkHttpbinHost) - + ":443/get"; + return std::string(_detail::AzureSdkHttpbinServerSchema) + "://" + + std::string(_detail::AzureSdkHttpbinServer) + ":443/get"; } inline static std::string Put() { - return std::string(AzureSdkHttpbinServerSchema) + "://" + std::string(AzureSdkHttpbinHost) - + "/put"; + return std::string(_detail::AzureSdkHttpbinServerSchema) + "://" + + std::string(_detail::AzureSdkHttpbinServer) + "/put"; } inline static std::string Delete() { - return std::string(AzureSdkHttpbinServerSchema) + "://" + std::string(AzureSdkHttpbinHost) - + "/delete"; + return std::string(_detail::AzureSdkHttpbinServerSchema) + "://" + + std::string(_detail::AzureSdkHttpbinServer) + "/delete"; } inline static std::string Patch() { - return std::string(AzureSdkHttpbinServerSchema) + "://" + std::string(AzureSdkHttpbinHost) - + "/patch"; + return std::string(_detail::AzureSdkHttpbinServerSchema) + "://" + + std::string(_detail::AzureSdkHttpbinServer) + "/patch"; + } + inline static std::string Host() { return std::string(_detail::AzureSdkHttpbinServer); } + inline static std::string Schema() + { + return std::string(_detail::AzureSdkHttpbinServerSchema); } - inline static std::string Host() { return std::string(AzureSdkHttpbinHost); } - inline static std::string Schema() { return std::string(AzureSdkHttpbinServerSchema); } }; static Azure::Core::Http::_internal::HttpPipeline CreateHttpPipeline( @@ -427,7 +427,11 @@ namespace Azure { namespace Core { namespace Test { #endif // defined(ENABLE_PROXY_TESTS) +#if _azure_DISABLE_HTTP_BIN_TESTS + TEST_F(TransportAdapterOptions, DISABLED_DisableCrlValidation) +#else TEST_F(TransportAdapterOptions, DisableCrlValidation) +#endif { Azure::Core::Url testUrl(AzureSdkHttpbinServer::Get());