Skip to content
20 changes: 19 additions & 1 deletion sdk/core/azure-core/test/ut/transport_policy_options.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -430,8 +430,13 @@ namespace Azure { namespace Core { namespace Test {
TEST_F(TransportAdapterOptions, DisableCrlValidation) TEST_F(TransportAdapterOptions, DisableCrlValidation)
{ {
Azure::Core::Url testUrl(AzureSdkHttpbinServer::Get()); Azure::Core::Url testUrl(AzureSdkHttpbinServer::Get());
// Azure::Core::Url testUrl("https://www.microsoft.com/");
// HTTP Connections. // HTTP Connections.
auto failedCounter = 0;
for (auto i = 0; i < 3; i++)
{
GTEST_LOG_(INFO) << "DisableCrlValidation test iteration " << i << ".";
try
{ {
Azure::Core::Http::Policies::TransportOptions transportOptions; Azure::Core::Http::Policies::TransportOptions transportOptions;


Expand All @@ -444,6 +449,19 @@ namespace Azure { namespace Core { namespace Test {
auto response = pipeline.Send(request, Azure::Core::Context::ApplicationContext); auto response = pipeline.Send(request, Azure::Core::Context::ApplicationContext);
EXPECT_EQ(response->GetStatusCode(), Azure::Core::Http::HttpStatusCode::Ok); EXPECT_EQ(response->GetStatusCode(), Azure::Core::Http::HttpStatusCode::Ok);
} }
catch (Azure::Core::Http::TransportException const&)
{
// CURL returns a connection error which triggers a transport exception.
GTEST_LOG_(INFO) << "DisableCrlValidation test iteration " << i
<< " failed with a TransportException.";
failedCounter++;
// We allow 1 intermittent failure, due to networking issues.
if (failedCounter > 1)
{
throw;
}
}
}
#if defined(ENABLE_PROXY_TESTS) #if defined(ENABLE_PROXY_TESTS)
if (IsSquidProxyRunning) if (IsSquidProxyRunning)
{ {
Expand Down