Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add retries to DisableCrlValidation test to improve reliability #5537

Merged
merged 9 commits into from
May 16, 2024
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)
ahsonkhan marked this conversation as resolved.
Show resolved Hide resolved
{
throw;
}
}
}
#if defined(ENABLE_PROXY_TESTS) #if defined(ENABLE_PROXY_TESTS)
if (IsSquidProxyRunning) if (IsSquidProxyRunning)
{ {
Expand Down