From 8b092ab1755cda7a862ad4ba92828acf2b76fff5 Mon Sep 17 00:00:00 2001 From: microzchang <110015819+microzchang@users.noreply.github.com> Date: Mon, 28 Apr 2025 10:42:02 +0800 Subject: [PATCH] Fix unstable test cases (#6541) --- .../test/ut/datalake_file_client_test.cpp | 6 +++++- .../test/ut/datalake_file_system_client_test.cpp | 12 ++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/sdk/storage/azure-storage-files-datalake/test/ut/datalake_file_client_test.cpp b/sdk/storage/azure-storage-files-datalake/test/ut/datalake_file_client_test.cpp index 77a8b5f7f..b025bdc86 100644 --- a/sdk/storage/azure-storage-files-datalake/test/ut/datalake_file_client_test.cpp +++ b/sdk/storage/azure-storage-files-datalake/test/ut/datalake_file_client_test.cpp @@ -588,7 +588,11 @@ namespace Azure { namespace Storage { namespace Test { EXPECT_TRUE(downloadResult.Value.Details.EncryptionContext.HasValue()); EXPECT_EQ(encryptionContext, downloadResult.Value.Details.EncryptionContext.Value()); // Assert DataLakeDirectoryClient::ListPaths - auto paths = directoryClient.ListPaths(false).Paths; + std::vector paths; + for (auto page = directoryClient.ListPaths(false); page.HasPage(); page.MoveToNextPage()) + { + paths.insert(paths.end(), page.Paths.begin(), page.Paths.end()); + } EXPECT_EQ(paths.size(), 1); EXPECT_TRUE(paths[0].EncryptionContext.HasValue()); EXPECT_EQ(encryptionContext, paths[0].EncryptionContext.Value()); diff --git a/sdk/storage/azure-storage-files-datalake/test/ut/datalake_file_system_client_test.cpp b/sdk/storage/azure-storage-files-datalake/test/ut/datalake_file_system_client_test.cpp index b84f2100b..f85865a14 100644 --- a/sdk/storage/azure-storage-files-datalake/test/ut/datalake_file_system_client_test.cpp +++ b/sdk/storage/azure-storage-files-datalake/test/ut/datalake_file_system_client_test.cpp @@ -272,10 +272,14 @@ namespace Azure { namespace Storage { namespace Test { EXPECT_NO_THROW(fileClient.ScheduleDeletion( Files::DataLake::ScheduleFileExpiryOriginType::Absolute, options)); - auto pagedResult = m_fileSystemClient->ListPaths(true); - EXPECT_EQ(1L, pagedResult.Paths.size()); - ASSERT_TRUE(pagedResult.Paths[0].ExpiresOn.HasValue()); - EXPECT_EQ(options.ExpiresOn.Value(), pagedResult.Paths[0].ExpiresOn.Value()); + std::vector paths; + for (auto page = m_fileSystemClient->ListPaths(true); page.HasPage(); page.MoveToNextPage()) + { + paths.insert(paths.end(), page.Paths.begin(), page.Paths.end()); + } + EXPECT_EQ(1L, paths.size()); + ASSERT_TRUE(paths[0].ExpiresOn.HasValue()); + EXPECT_EQ(options.ExpiresOn.Value(), paths[0].ExpiresOn.Value()); } TEST_F(DataLakeFileSystemClientTest, UnencodedPathDirectoryFileNameWorks)