Adding test framework for azure storage. (#152)
This commit is contained in:
parent
11f842bfbe
commit
6e01498038
@ -28,6 +28,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
if(BUILD_TESTING)
|
||||
# tests
|
||||
include(AddGoogleTest)
|
||||
enable_testing ()
|
||||
add_subdirectory(sdk/core/azure-core/test)
|
||||
endif()
|
||||
|
||||
@ -3,8 +3,6 @@
|
||||
|
||||
cmake_minimum_required (VERSION 3.12)
|
||||
|
||||
include(AddGoogleTest)
|
||||
|
||||
set(TARGET_NAME "azure-core-test")
|
||||
|
||||
project (${TARGET_NAME} LANGUAGES CXX)
|
||||
|
||||
@ -30,10 +30,6 @@ set(AZURE_STORAGE_SOURCE
|
||||
src/common/storage_url_builder.cpp
|
||||
)
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
|
||||
add_library(azure-storage ${AZURE_STORAGE_HEADER} ${AZURE_STORAGE_SOURCE})
|
||||
|
||||
find_package(LibXml2 REQUIRED)
|
||||
@ -61,5 +57,9 @@ if(BUILD_STORAGE_SAMPLES)
|
||||
add_subdirectory(sample)
|
||||
endif()
|
||||
|
||||
if(BUILD_TESTING)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
# make sure that users can consume the project as a library.
|
||||
add_library (azure::storage ALIAS azure-storage)
|
||||
|
||||
21
sdk/storage/test/CMakeLists.txt
Normal file
21
sdk/storage/test/CMakeLists.txt
Normal file
@ -0,0 +1,21 @@
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
cmake_minimum_required (VERSION 3.12)
|
||||
|
||||
if (MSVC)
|
||||
# There will be many const conparisons in test code.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd6326")
|
||||
endif()
|
||||
|
||||
add_executable (
|
||||
azure-storage-test
|
||||
test_base.hpp
|
||||
test_base.cpp
|
||||
block_blob_client_test.cpp
|
||||
main.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(azure-storage-test PRIVATE azure-storage)
|
||||
|
||||
add_gtest(azure-storage-test)
|
||||
10
sdk/storage/test/block_blob_client_test.cpp
Normal file
10
sdk/storage/test/block_blob_client_test.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#include "test_base.hpp"
|
||||
#include "blobs/blob.hpp"
|
||||
|
||||
TEST(BlockBlobClientTest, StageBlockTest)
|
||||
{
|
||||
EXPECT_EQ("", std::string(Azure::Storage::Test::TestUtility::k_ACCOUNT_SAS));
|
||||
}
|
||||
10
sdk/storage/test/main.cpp
Normal file
10
sdk/storage/test/main.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
15
sdk/storage/test/test_base.cpp
Normal file
15
sdk/storage/test/test_base.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#include "test_base.hpp"
|
||||
|
||||
namespace Azure { namespace Storage { namespace Test {
|
||||
|
||||
constexpr const char* TestUtility::k_STANDARD_STORAGE_CONNECTION_STRING;
|
||||
constexpr const char* TestUtility::k_PREMIUM_STORAGE_CONNECTION_STRING;
|
||||
constexpr const char* TestUtility::k_BLOB_STORAGE_CONNECTION_STRING;
|
||||
constexpr const char* TestUtility::k_PREMIUM_FILE_CONNECTION_STRING;
|
||||
constexpr const char* TestUtility::k_ADLS_GEN2_CONNECTION_STRING;
|
||||
constexpr const char* TestUtility::k_ACCOUNT_SAS;
|
||||
|
||||
}}} // namespace Azure::Storage::Test
|
||||
21
sdk/storage/test/test_base.hpp
Normal file
21
sdk/storage/test/test_base.hpp
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace Azure { namespace Storage { namespace Test {
|
||||
|
||||
struct TestUtility
|
||||
{
|
||||
constexpr static const char* k_STANDARD_STORAGE_CONNECTION_STRING = "";
|
||||
constexpr static const char* k_PREMIUM_STORAGE_CONNECTION_STRING = "";
|
||||
constexpr static const char* k_BLOB_STORAGE_CONNECTION_STRING = "";
|
||||
constexpr static const char* k_PREMIUM_FILE_CONNECTION_STRING = "";
|
||||
constexpr static const char* k_ADLS_GEN2_CONNECTION_STRING = "";
|
||||
// TODO: Temporary
|
||||
constexpr static const char* k_ACCOUNT_SAS = "";
|
||||
};
|
||||
|
||||
}}}
|
||||
Loading…
Reference in New Issue
Block a user