diff --git a/sdk/core/azure-core/src/http/curl/curl_session_private.hpp b/sdk/core/azure-core/src/http/curl/curl_session_private.hpp index af46db23c..9c5ba99fa 100644 --- a/sdk/core/azure-core/src/http/curl/curl_session_private.hpp +++ b/sdk/core/azure-core/src/http/curl/curl_session_private.hpp @@ -23,6 +23,7 @@ // Define the class name that reads from ConnectionPool private members namespace Azure { namespace Core { namespace Test { class CurlConnectionPool_connectionPoolTest_Test; + class SdkWithLibcurl_globalCleanUp_Test; }}} // namespace Azure::Core::Test #endif @@ -43,6 +44,7 @@ namespace Azure { namespace Core { namespace Http { #ifdef TESTING_BUILD // Give access to private to this tests class friend class Azure::Core::Test::CurlConnectionPool_connectionPoolTest_Test; + friend class Azure::Core::Test::SdkWithLibcurl_globalCleanUp_Test; #endif private: /** diff --git a/sdk/core/azure-core/test/ut/azure_libcurl_core_main_test.cpp b/sdk/core/azure-core/test/ut/azure_libcurl_core_main_test.cpp index 56d090f6c..169919e83 100644 --- a/sdk/core/azure-core/test/ut/azure_libcurl_core_main_test.cpp +++ b/sdk/core/azure-core/test/ut/azure_libcurl_core_main_test.cpp @@ -46,6 +46,12 @@ namespace Azure { namespace Core { namespace Test { session->Perform(Azure::Core::Context::ApplicationContext); // Reading all the response session->ReadToEnd(Azure::Core::Context::ApplicationContext); + + // If all three of these conditions are true, the connection should be moved to the connection + // pool. + EXPECT_TRUE(session->IsEOF()); + EXPECT_TRUE(session->m_keepAlive); + EXPECT_FALSE(session->m_connectionUpgraded); } // Check that after the connection is gone, it is moved back to the pool EXPECT_EQ( @@ -57,10 +63,10 @@ namespace Azure { namespace Core { namespace Test { int main(int argc, char** argv) { - // Declare a signal handler to report unhandled exceptions on Windows - this is not needed for - // other OS's as they will print the exception to stderr in their terminate() function. +// Declare a signal handler to report unhandled exceptions on Windows - this is not needed for +// other OS's as they will print the exception to stderr in their terminate() function. #if defined(AZ_PLATFORM_WINDOWS) - // Ensure that all calls to abort() no longer pop up a modal dialog on Windows. +// Ensure that all calls to abort() no longer pop up a modal dialog on Windows. #if defined(_DEBUG) && defined(_MSC_VER) _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG); #endif