Add test cases for simplified storage headers (#4880)

This commit is contained in:
JinmingHu 2023-08-16 20:09:30 +08:00 committed by GitHub
parent 9ef9483d92
commit bbf6c9c3ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 149 additions and 0 deletions

View File

@ -32,6 +32,7 @@ add_executable (
macro_guard.cpp
page_blob_client_test.cpp
page_blob_client_test.hpp
simplified_header_test.cpp
storage_retry_policy_test.cpp
storage_timeout_test.cpp
# Include shared test source code

View File

@ -0,0 +1,39 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#include <azure/storage/blobs.hpp>
#include <gtest/gtest.h>
namespace Azure { namespace Storage { namespace Test {
TEST(SimplifiedHeader, StorageBlobs)
{
Azure::Storage::Blobs::BlobServiceClient serviceClient("https://account.blob.core.windows.net");
Azure::Storage::Blobs::BlobContainerClient containerClient(
"https://account.blob.core.windows.net/container");
Azure::Storage::Blobs::BlobClient blobClinet(
"https://account.blob.core.windows.net/container/blob");
Azure::Storage::Blobs::BlockBlobClient blockBlobClinet(
"https://account.blob.core.windows.net/container/blob");
Azure::Storage::Blobs::PageBlobClient pageBlobClinet(
"https://account.blob.core.windows.net/container/blob");
Azure::Storage::Blobs::AppendBlobClient appendBlobClinet(
"https://account.blob.core.windows.net/container/blob");
Azure::Storage::Blobs::BlobLeaseClient leaseClient(
containerClient, Azure::Storage::Blobs::BlobLeaseClient::CreateUniqueLeaseId());
Azure::Storage::Sas::BlobSasBuilder sasBuilder;
StorageSharedKeyCredential keyCredential("account", "key");
try
{
}
catch (Azure::Storage::StorageException& e)
{
std::cout << e.what() << std::endl;
}
}
}}} // namespace Azure::Storage::Test

View File

@ -29,6 +29,7 @@ add_executable (
datalake_service_client_test.cpp
datalake_service_client_test.hpp
macro_guard.cpp
simplified_header_test.cpp
# Include shared test source code
${CMAKE_CURRENT_SOURCE_DIR}/../../../azure-storage-common/test/ut/test_base.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../azure-storage-common/test/ut/test_base.hpp

View File

@ -0,0 +1,39 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#include <azure/storage/files/datalake.hpp>
#include <gtest/gtest.h>
namespace Azure { namespace Storage { namespace Test {
TEST(SimplifiedHeader, StorageFilesDataLake)
{
Azure::Storage::Files::DataLake::DataLakeServiceClient serviceClient(
"https://account.blob.core.windows.net");
Azure::Storage::Files::DataLake::DataLakeFileSystemClient containerClient(
"https://account.dfs.core.windows.net/container");
Azure::Storage::Files::DataLake::DataLakePathClient pathClinet(
"https://account.dfs.core.windows.net/container/path");
Azure::Storage::Files::DataLake::DataLakeFileClient fileClinet(
"https://account.dfs.core.windows.net/container/path");
Azure::Storage::Files::DataLake::DataLakeDirectoryClient dirClinet(
"https://account.dfs.core.windows.net/container/path");
Azure::Storage::Files::DataLake::DataLakeLeaseClient leaseClient(
containerClient,
Azure::Storage::Files::DataLake::DataLakeLeaseClient::CreateUniqueLeaseId());
Azure::Storage::Sas::DataLakeSasBuilder sasBuilder;
StorageSharedKeyCredential keyCredential("account", "key");
try
{
}
catch (Azure::Storage::StorageException& e)
{
std::cout << e.what() << std::endl;
}
}
}}} // namespace Azure::Storage::Test

View File

@ -27,6 +27,7 @@ add_executable (
share_sas_test.cpp
share_service_client_test.cpp
share_service_client_test.hpp
simplified_header_test.cpp
# Include shared test source code
${CMAKE_CURRENT_SOURCE_DIR}/../../../azure-storage-common/test/ut/test_base.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../azure-storage-common/test/ut/test_base.hpp

View File

@ -0,0 +1,37 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#include <azure/storage/files/shares.hpp>
#include <gtest/gtest.h>
namespace Azure { namespace Storage { namespace Test {
TEST(SimplifiedHeader, StorageFilesShares)
{
Azure::Storage::Files::Shares::ShareServiceClient serviceClient(
"https://account.blob.core.windows.net");
Azure::Storage::Files::Shares::ShareClient shareClient(
"https://account.file.core.windows.net/share");
Azure::Storage::Files::Shares::ShareFileClient fileClient(
"https://account.file.core.windows.net/share/file");
Azure::Storage::Files::Shares::ShareDirectoryClient dirClient(
"https://account.file.core.windows.net/share/dir");
Azure::Storage::Files::Shares::ShareLeaseClient leaseClient(
shareClient, Azure::Storage::Files::Shares::ShareLeaseClient::CreateUniqueLeaseId());
Azure::Storage::Sas::ShareSasBuilder sasBuilder;
StorageSharedKeyCredential keyCredential("account", "key");
try
{
}
catch (Azure::Storage::StorageException& e)
{
std::cout << e.what() << std::endl;
}
}
}}} // namespace Azure::Storage::Test

View File

@ -22,6 +22,7 @@ add_executable (
queue_client_test.hpp
queue_sas_test.cpp
queue_service_client_test.cpp
simplified_header_test.cpp
# Include shared test source code
${CMAKE_CURRENT_SOURCE_DIR}/../../../azure-storage-common/test/ut/test_base.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../azure-storage-common/test/ut/test_base.hpp

View File

@ -0,0 +1,30 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#include <azure/storage/queues.hpp>
#include <gtest/gtest.h>
namespace Azure { namespace Storage { namespace Test {
TEST(SimplifiedHeader, StorageQueues)
{
Azure::Storage::Queues::QueueServiceClient serviceClient(
"https://account.blob.core.windows.net");
Azure::Storage::Queues::QueueClient containerClient(
"https://account.queue.core.windows.net/queue");
Azure::Storage::Sas::QueueSasBuilder sasBuilder;
StorageSharedKeyCredential keyCredential("account", "key");
try
{
}
catch (Azure::Storage::StorageException& e)
{
std::cout << e.what() << std::endl;
}
}
}}} // namespace Azure::Storage::Test