From 8059148808e3e770e8dbe97da7a3fced5d8dcb16 Mon Sep 17 00:00:00 2001 From: Ryan Hurey Date: Fri, 21 Nov 2025 22:57:56 +0000 Subject: [PATCH] Phase 3 complete --- sdk/core/azure-core/test/ut/CMakeLists.txt | 5 ++++- sdk/core/azure-core/test/ut/nullable_test.cpp | 4 ++-- sdk/core/azure-core/test/ut/websocket_test.cpp | 10 +++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/sdk/core/azure-core/test/ut/CMakeLists.txt b/sdk/core/azure-core/test/ut/CMakeLists.txt index 64975b764..391da1853 100644 --- a/sdk/core/azure-core/test/ut/CMakeLists.txt +++ b/sdk/core/azure-core/test/ut/CMakeLists.txt @@ -97,6 +97,7 @@ add_executable ( transport_policy_options.cpp url_test.cpp uuid_test.cpp + websocket_test.cpp ) target_compile_definitions(azure-core-test PRIVATE _azure_BUILDING_TESTS) @@ -134,7 +135,9 @@ endif() # Additional test files to be copied to the output directory. set(TEST_ADDITIONAL_FILES - ${CMAKE_CURRENT_LIST_DIR}/requirements.txt + ${CMAKE_CURRENT_LIST_DIR}/requirements.txt + ${CMAKE_CURRENT_LIST_DIR}/websocket_server.py + ${CMAKE_CURRENT_LIST_DIR}/Start-WebSocketServer.ps1 ) add_custom_command(TARGET azure-core-test POST_BUILD diff --git a/sdk/core/azure-core/test/ut/nullable_test.cpp b/sdk/core/azure-core/test/ut/nullable_test.cpp index b25ec791f..3ace50174 100644 --- a/sdk/core/azure-core/test/ut/nullable_test.cpp +++ b/sdk/core/azure-core/test/ut/nullable_test.cpp @@ -264,8 +264,8 @@ TEST(Nullable, ConstexprAndRvalue) #pragma clang diagnostic ignored "-Wpessimizing-move" // cspell:disable-line #endif // __clang__ - Nullable nullableInt0(std::move(Nullable())); - Nullable nullableInt11(std::move(Nullable(11))); + Nullable nullableInt0{Nullable{}}; + Nullable nullableInt11{Nullable{11}}; #if defined(__clang__) #pragma clang diagnostic pop // NOLINT(clang-diagnostic-unknown-pragmas) diff --git a/sdk/core/azure-core/test/ut/websocket_test.cpp b/sdk/core/azure-core/test/ut/websocket_test.cpp index 316093496..b91393737 100644 --- a/sdk/core/azure-core/test/ut/websocket_test.cpp +++ b/sdk/core/azure-core/test/ut/websocket_test.cpp @@ -60,7 +60,7 @@ TEST_F(WebSocketTests, OpenSimpleSocket) // When running this test locally, the call times out, so drop in a 5 second timeout on // the request. - Azure::Core::Context requestContext = Azure::Core::Context::ApplicationContext.WithDeadline( + Azure::Core::Context requestContext = Azure::Core::Context{}.WithDeadline( std::chrono::system_clock::now() + 5s); EXPECT_THROW(defaultSocket.Open(requestContext), std::runtime_error); } @@ -327,7 +327,7 @@ TEST_F(WebSocketTests, PingReceiveTest) { GTEST_LOG_(INFO) << "Sleeping for 15 seconds to collect pings."; - Azure::Core::Context receiveContext = Azure::Core::Context::ApplicationContext.WithDeadline( + Azure::Core::Context receiveContext = Azure::Core::Context{}.WithDeadline( Azure::DateTime{std::chrono::system_clock::now() + 15s}); EXPECT_THROW(testSocket.ReceiveFrame(receiveContext), Azure::Core::OperationCancelledException); auto statistics = testSocket.GetStatistics(); @@ -361,7 +361,7 @@ TEST_F(WebSocketTests, PingSendTest) GTEST_LOG_(INFO) << "Sleeping for 10 seconds to collect pings."; // Note that we cannot collect incoming pings or outgoing pongs unless we are receiving // data from the server. - Azure::Core::Context receiveContext = Azure::Core::Context::ApplicationContext.WithDeadline( + Azure::Core::Context receiveContext = Azure::Core::Context{}.WithDeadline( Azure::DateTime{std::chrono::system_clock::now() + 10s}); EXPECT_THROW(testSocket.ReceiveFrame(receiveContext), Azure::Core::OperationCancelledException); auto statistics = testSocket.GetStatistics(); @@ -409,7 +409,7 @@ TEST_F(WebSocketTests, MultiThreadedTestOnSingleSocket) std::chrono::time_point startTime = std::chrono::system_clock::now(); // Set the context to expire *after* the test is supposed to finish. - Azure::Core::Context context = Azure::Core::Context::ApplicationContext.WithDeadline( + Azure::Core::Context context = Azure::Core::Context{}.WithDeadline( Azure::DateTime{startTime} + testDuration + 10s); size_t iteration = 0; try @@ -571,7 +571,7 @@ TEST_F(WebSocketTests, MultiThreadedTestOnMultipleSockets) std::chrono::time_point startTime = std::chrono::system_clock::now(); // Set the context to expire *after* the test is supposed to finish. - Azure::Core::Context context = Azure::Core::Context::ApplicationContext.WithDeadline( + Azure::Core::Context context = Azure::Core::Context{}.WithDeadline( Azure::DateTime{startTime} + testDuration + 10s); size_t iteration = 0; try