Add test cases to cover paged response APIs (#4828)
* add more test case for paged response APIs * recordings
This commit is contained in:
Родитель
c8693fe8b3
Коммит
1634d5825e
|
@ -2,5 +2,5 @@
|
|||
"AssetsRepo": "Azure/azure-sdk-assets",
|
||||
"AssetsRepoPrefixPath": "cpp",
|
||||
"TagPrefix": "cpp/storage",
|
||||
"Tag": "cpp/storage_02a857d53e"
|
||||
"Tag": "cpp/storage_67000ec514"
|
||||
}
|
||||
|
|
|
@ -205,11 +205,13 @@ namespace Azure { namespace Storage { namespace Test {
|
|||
}
|
||||
|
||||
Azure::Storage::Blobs::ListBlobsOptions options;
|
||||
options.PageSizeHint = 4;
|
||||
options.PageSizeHint = 3;
|
||||
std::set<std::string> listBlobs;
|
||||
int numPages = 0;
|
||||
for (auto pageResult = containerClient.ListBlobs(options); pageResult.HasPage();
|
||||
pageResult.MoveToNextPage())
|
||||
{
|
||||
++numPages;
|
||||
EXPECT_FALSE(pageResult.RawResponse->GetHeaders().at(_internal::HttpHeaderRequestId).empty());
|
||||
EXPECT_FALSE(pageResult.RawResponse->GetHeaders().at(_internal::HttpHeaderDate).empty());
|
||||
EXPECT_FALSE(
|
||||
|
@ -254,6 +256,7 @@ namespace Azure { namespace Storage { namespace Test {
|
|||
listBlobs.insert(blob.Name);
|
||||
}
|
||||
}
|
||||
EXPECT_GT(numPages, 2);
|
||||
EXPECT_TRUE(
|
||||
std::includes(listBlobs.begin(), listBlobs.end(), p1p2Blobs.begin(), p1p2Blobs.end()));
|
||||
|
||||
|
@ -312,10 +315,13 @@ namespace Azure { namespace Storage { namespace Test {
|
|||
for (const auto& p : {prefix1, prefix2})
|
||||
{
|
||||
options.Prefix = p + delimiter;
|
||||
options.PageSizeHint = 1;
|
||||
int numPages = 0;
|
||||
for (auto pageResult = containerClient.ListBlobsByHierarchy(delimiter, options);
|
||||
pageResult.HasPage();
|
||||
pageResult.MoveToNextPage())
|
||||
{
|
||||
++numPages;
|
||||
EXPECT_EQ(pageResult.Delimiter, delimiter);
|
||||
EXPECT_EQ(pageResult.Prefix, options.Prefix.Value());
|
||||
EXPECT_TRUE(pageResult.BlobPrefixes.empty());
|
||||
|
@ -324,6 +330,7 @@ namespace Azure { namespace Storage { namespace Test {
|
|||
items.emplace(i.Name);
|
||||
}
|
||||
}
|
||||
EXPECT_GT(numPages, 2);
|
||||
}
|
||||
EXPECT_EQ(items, blobs);
|
||||
}
|
||||
|
|
|
@ -100,11 +100,13 @@ namespace Azure { namespace Storage { namespace Test {
|
|||
}
|
||||
|
||||
Azure::Storage::Blobs::ListBlobContainersOptions options;
|
||||
options.PageSizeHint = 4;
|
||||
options.PageSizeHint = 3;
|
||||
std::set<std::string> listContainers;
|
||||
int numPages = 0;
|
||||
for (auto pageResult = serviceClient.ListBlobContainers(options); pageResult.HasPage();
|
||||
pageResult.MoveToNextPage())
|
||||
{
|
||||
++numPages;
|
||||
EXPECT_FALSE(pageResult.RawResponse->GetHeaders().at(_internal::HttpHeaderRequestId).empty());
|
||||
EXPECT_FALSE(pageResult.RawResponse->GetHeaders().at(_internal::HttpHeaderDate).empty());
|
||||
EXPECT_FALSE(
|
||||
|
@ -115,6 +117,7 @@ namespace Azure { namespace Storage { namespace Test {
|
|||
listContainers.insert(container.Name);
|
||||
}
|
||||
}
|
||||
EXPECT_GT(numPages, 2);
|
||||
EXPECT_TRUE(std::includes(
|
||||
listContainers.begin(),
|
||||
listContainers.end(),
|
||||
|
|
|
@ -125,8 +125,14 @@ namespace Azure { namespace Storage { namespace Test {
|
|||
// List max result
|
||||
Files::DataLake::ListFileSystemsOptions options;
|
||||
options.PageSizeHint = 2;
|
||||
auto response = m_dataLakeServiceClient->ListFileSystems(options);
|
||||
EXPECT_LE(2U, response.FileSystems.size());
|
||||
int numPages = 0;
|
||||
for (auto page = m_dataLakeServiceClient->ListFileSystems(options); page.HasPage();
|
||||
page.MoveToNextPage())
|
||||
{
|
||||
EXPECT_LE(page.FileSystems.size(), 2U);
|
||||
++numPages;
|
||||
}
|
||||
EXPECT_GT(numPages, 2);
|
||||
}
|
||||
for (const auto& fsName : filesystemSet1)
|
||||
{
|
||||
|
|
|
@ -88,8 +88,14 @@ namespace Azure { namespace Storage { namespace Test {
|
|||
// List max result
|
||||
Files::Shares::ListSharesOptions options;
|
||||
options.PageSizeHint = 2;
|
||||
auto response = m_shareServiceClient->ListShares(options);
|
||||
EXPECT_LE(2U, response.Shares.size());
|
||||
int numPages = 0;
|
||||
for (auto page = m_shareServiceClient->ListShares(options); page.HasPage();
|
||||
page.MoveToNextPage())
|
||||
{
|
||||
EXPECT_LE(page.Shares.size(), 2U);
|
||||
++numPages;
|
||||
}
|
||||
EXPECT_GT(numPages, 2);
|
||||
}
|
||||
for (const auto& shareName : shareSet1)
|
||||
{
|
||||
|
|
|
@ -83,6 +83,7 @@ namespace Azure { namespace Storage { namespace Test {
|
|||
Azure::Storage::Queues::ListQueuesOptions options;
|
||||
options.PageSizeHint = 4;
|
||||
std::set<std::string> listQueues;
|
||||
int numPages = 0;
|
||||
for (auto pageResult = m_queueServiceClient->ListQueues(options); pageResult.HasPage();
|
||||
pageResult.MoveToNextPage())
|
||||
{
|
||||
|
@ -95,7 +96,9 @@ namespace Azure { namespace Storage { namespace Test {
|
|||
{
|
||||
listQueues.insert(q.Name);
|
||||
}
|
||||
++numPages;
|
||||
}
|
||||
EXPECT_GT(numPages, 2);
|
||||
EXPECT_TRUE(
|
||||
std::includes(listQueues.begin(), listQueues.end(), p1p2Queues.begin(), p1p2Queues.end()));
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче