From fe2930258304aa806e461553de717d3777044c00 Mon Sep 17 00:00:00 2001 From: Anton Kolesnyk <41349689+antkmsft@users.noreply.github.com> Date: Thu, 12 Jan 2023 16:53:55 -0800 Subject: [PATCH] Revert MultipleCrlOperations test to the previous version (#4238) * Experiment with CI and MultipleCrlOperations test * Switch to an older, less failure-proof version of the test from yesterday * Switch Ubuntu18 to Azure Pipelines as well * Undo CI changes just to make sure it fails * Apply CI machine pool changes * Move Ubuntu20 to general pool * Move Ubuntu20 to general pool * Move Ubuntu20 to perf pool * Revert all changes in platform-matrix.json Co-authored-by: Anton Kolesnyk Co-authored-by: Mike Harder --- .../test/ut/transport_policy_options.cpp | 79 +++++++------------ 1 file changed, 29 insertions(+), 50 deletions(-) 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 443bbf606..4483a6515 100644 --- a/sdk/core/azure-core/test/ut/transport_policy_options.cpp +++ b/sdk/core/azure-core/test/ut/transport_policy_options.cpp @@ -524,20 +524,16 @@ namespace Azure { namespace Core { namespace Test { #endif } - // This test started to fail consistently in CI on Linux. - // It should be fixed, but to unblock CI, there is a workaround below. -#if !defined(AZ_PLATFORM_LINUX) TEST_F(TransportAdapterOptions, MultipleCrlOperations) { // LetsEncrypt certificates don't contain a distribution point URL extension. While this seems // to work when run locally, it fails in the CI pipeline. "https://www.wikipedia.org" uses a // LetsEncrypt certificate, so when testing manually, it is important to add it to the list. - std::vector> testUrls{ - {AzureSdkHttpbinServer::Get(), true}, // Uses a Microsoft/DigiCert certificate. - {"https://aws.amazon.com", true}, // Uses a Amazon/Starfield Technologies certificate. - // {"https://www.example.com/", true}, // Uses a DigiCert certificate. Does not work - // correctly from Linux as of 2023-01-09. - {"https://www.google.com/", true}, // Uses a google certificate. + std::vector testUrls{ + AzureSdkHttpbinServer::Get(), // Uses a Microsoft/DigiCert certificate. + "https://aws.amazon.com", // Uses a Amazon/Starfield Technologies certificate. + "https://www.example.com/", // Uses a DigiCert certificate. + "https://www.google.com/", // Uses a google certificate. }; GTEST_LOG_(INFO) << "Basic test calls."; @@ -548,27 +544,17 @@ namespace Azure { namespace Core { namespace Test { transportOptions.EnableCertificateRevocationListCheck = false; HttpPipeline pipeline(CreateHttpPipeline(transportOptions)); - for (auto& target : testUrls) + for (auto const& target : testUrls) { - GTEST_LOG_(INFO) << "Test " << target.first; - Azure::Core::Url url(target.first); + GTEST_LOG_(INFO) << "Test " << target; + Azure::Core::Url url(target); auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Get, url); std::unique_ptr response; - try + EXPECT_NO_THROW( + response = pipeline.Send(request, Azure::Core::Context::ApplicationContext)); + if (response && response->GetStatusCode() != Azure::Core::Http::HttpStatusCode::Found) { - response = pipeline.Send(request, Azure::Core::Context::ApplicationContext); - } - catch (Azure::Core::Http::TransportException& ex) - { - GTEST_LOG_(INFO) << "Error " << ex.what() << " accessing site " << target.first; - target.second = false; - } - if (target.second) - { - if (response && response->GetStatusCode() != Azure::Core::Http::HttpStatusCode::Found) - { - EXPECT_EQ(response->GetStatusCode(), Azure::Core::Http::HttpStatusCode::Ok); - } + EXPECT_EQ(response->GetStatusCode(), Azure::Core::Http::HttpStatusCode::Ok); } } } @@ -585,19 +571,15 @@ namespace Azure { namespace Core { namespace Test { for (auto const& target : testUrls) { - // Only try to access the server if we were able to contact it earlier. - if (target.second) + GTEST_LOG_(INFO) << "Test " << target; + Azure::Core::Url url(target); + auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Get, url); + std::unique_ptr response; + EXPECT_NO_THROW( + response = pipeline.Send(request, Azure::Core::Context::ApplicationContext)); + if (response && response->GetStatusCode() != Azure::Core::Http::HttpStatusCode::Found) { - GTEST_LOG_(INFO) << "Test " << target.first; - Azure::Core::Url url(target.first); - auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Get, url); - std::unique_ptr response; - EXPECT_NO_THROW( - response = pipeline.Send(request, Azure::Core::Context::ApplicationContext)); - if (response && response->GetStatusCode() != Azure::Core::Http::HttpStatusCode::Found) - { - EXPECT_EQ(response->GetStatusCode(), Azure::Core::Http::HttpStatusCode::Ok); - } + EXPECT_EQ(response->GetStatusCode(), Azure::Core::Http::HttpStatusCode::Ok); } } } @@ -614,23 +596,19 @@ namespace Azure { namespace Core { namespace Test { for (auto const& target : testUrls) { - if (target.second) + GTEST_LOG_(INFO) << "Test " << target; + Azure::Core::Url url(target); + auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Get, url); + std::unique_ptr response; + EXPECT_NO_THROW( + response = pipeline.Send(request, Azure::Core::Context::ApplicationContext)); + if (response && response->GetStatusCode() != Azure::Core::Http::HttpStatusCode::Found) { - GTEST_LOG_(INFO) << "Test " << target.first; - Azure::Core::Url url(target.first); - auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Get, url); - std::unique_ptr response; - EXPECT_NO_THROW( - response = pipeline.Send(request, Azure::Core::Context::ApplicationContext)); - if (response && response->GetStatusCode() != Azure::Core::Http::HttpStatusCode::Found) - { - EXPECT_EQ(response->GetStatusCode(), Azure::Core::Http::HttpStatusCode::Ok); - } + EXPECT_EQ(response->GetStatusCode(), Azure::Core::Http::HttpStatusCode::Ok); } } } } -#endif TEST_F(TransportAdapterOptions, TestRootCertificate) { @@ -937,4 +915,5 @@ namespace Azure { namespace Core { namespace Test { EXPECT_THROW(proxyServer.IsAlive(), Azure::Core::Http::TransportException); } + }}} // namespace Azure::Core::Test