Core perf tests consolidation (#5363)
* mroe quotes * dssf * compact the tests in the proper folder * 2 more tests * eqwq * enabled all except http * endline
This commit is contained in:
parent
46fe50212c
commit
2a9934a596
@ -9,8 +9,12 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
set(
|
||||
AZURE_CORE_PERF_TEST_HEADER
|
||||
inc/azure/core/test/delay_test.hpp
|
||||
inc/azure/core/test/exception_test.hpp
|
||||
inc/azure/core/test/extended_options_test.hpp
|
||||
inc/azure/core/test/http_transport_test.hpp
|
||||
inc/azure/core/test/json_test.hpp
|
||||
inc/azure/core/test/no_op_test.hpp
|
||||
inc/azure/core/test/nullable_test.hpp
|
||||
inc/azure/core/test/pipeline_test.hpp
|
||||
inc/azure/core/test/uuid_test.hpp
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
namespace Azure { namespace Perf { namespace Test {
|
||||
namespace Azure { namespace Core { namespace Test {
|
||||
|
||||
namespace _detail {
|
||||
static std::atomic_uint64_t DelayTestInstanceCount(0);
|
||||
@ -77,14 +77,14 @@ namespace Azure { namespace Perf { namespace Test {
|
||||
std::vector<Azure::Perf::TestOption> GetTestOptions() override
|
||||
{
|
||||
return {
|
||||
{"InitialDelayMs", {"-m"}, "Initial delay (in milliseconds). Default to 1000 (1sec)", 1},
|
||||
{"InitialDelayMs", {"--m"}, "Initial delay (in milliseconds). Default to 1000 (1sec)", 1},
|
||||
{"InstanceGrowthFactor",
|
||||
{"-n"},
|
||||
{"--n"},
|
||||
"Instance growth factor. The delay of instance N will be (InitialDelayMS * "
|
||||
"(InstanceGrowthFactor ^ InstanceCount)). Default to 1",
|
||||
1},
|
||||
{"IterationGrowthFactor",
|
||||
{"-t"},
|
||||
{"--t"},
|
||||
"Initial delay (in milliseconds). The delay of iteration N will be (InitialDelayMS * "
|
||||
"(IterationGrowthFactor ^ IterationCount)). Default to 1",
|
||||
1}};
|
||||
@ -101,9 +101,9 @@ namespace Azure { namespace Perf { namespace Test {
|
||||
"delay",
|
||||
"The no op test with a configurable time delay for the main test loop.",
|
||||
[](Azure::Perf::TestOptions options) {
|
||||
return std::make_unique<Azure::Perf::Test::DelayTest>(options);
|
||||
return std::make_unique<Azure::Core::Test::DelayTest>(options);
|
||||
}};
|
||||
}
|
||||
};
|
||||
|
||||
}}} // namespace Azure::Perf::Test
|
||||
}}} // namespace Azure::Core::Test
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Azure { namespace Perf { namespace Test {
|
||||
namespace Azure { namespace Core { namespace Test {
|
||||
|
||||
/**
|
||||
* @brief Measures the overhead of creating, throwing, and catching an exception (compared to
|
||||
@ -57,9 +57,9 @@ namespace Azure { namespace Perf { namespace Test {
|
||||
"exception",
|
||||
"Measure how the impact of catching a runtime exception.",
|
||||
[](Azure::Perf::TestOptions options) {
|
||||
return std::make_unique<Azure::Perf::Test::ExceptionTest>(options);
|
||||
return std::make_unique<Azure::Core::Test::ExceptionTest>(options);
|
||||
}};
|
||||
}
|
||||
};
|
||||
|
||||
}}} // namespace Azure::Perf::Test
|
||||
}}} // namespace Azure::Core::Test
|
||||
@ -14,7 +14,7 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace Azure { namespace Perf { namespace Test {
|
||||
namespace Azure { namespace Core { namespace Test {
|
||||
|
||||
/**
|
||||
* @brief A performance test that defines a test option.
|
||||
@ -47,7 +47,7 @@ namespace Azure { namespace Perf { namespace Test {
|
||||
*/
|
||||
std::vector<Azure::Perf::TestOption> GetTestOptions() override
|
||||
{
|
||||
return {{"extraOption", {"-e"}, "Example for extended option for test.", 1}};
|
||||
return {{"extraOption", {"--e"}, "Example for extended option for test.", 1}};
|
||||
}
|
||||
|
||||
/**
|
||||
@ -62,9 +62,9 @@ namespace Azure { namespace Perf { namespace Test {
|
||||
"Demostrate how to include a test option to a test and measures how expensive is to do "
|
||||
"it.",
|
||||
[](Azure::Perf::TestOptions options) {
|
||||
return std::make_unique<Azure::Perf::Test::ExtendedOptionsTest>(options);
|
||||
return std::make_unique<Azure::Core::Test::ExtendedOptionsTest>(options);
|
||||
}};
|
||||
}
|
||||
};
|
||||
|
||||
}}} // namespace Azure::Perf::Test
|
||||
}}} // namespace Azure::Core::Test
|
||||
@ -139,7 +139,7 @@ namespace Azure { namespace Core { namespace Test {
|
||||
static Azure::Perf::TestMetadata GetTestMetadata()
|
||||
{
|
||||
return {
|
||||
"HTTPTransportTest",
|
||||
"httpTransport",
|
||||
"Measures HTTP transport performance",
|
||||
[](Azure::Perf::TestOptions options) {
|
||||
return std::make_unique<Azure::Core::Test::HTTPTransportTest>(options);
|
||||
|
||||
@ -310,7 +310,7 @@ namespace Azure { namespace Core { namespace Test {
|
||||
static Azure::Perf::TestMetadata GetTestMetadata()
|
||||
{
|
||||
return {
|
||||
"JsonTest",
|
||||
"json",
|
||||
"Measures Json serialize/deserialize performance",
|
||||
[](Azure::Perf::TestOptions options) {
|
||||
return std::make_unique<Azure::Core::Test::JsonTest>(options);
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Azure { namespace Perf { namespace Test {
|
||||
namespace Azure { namespace Core { namespace Test {
|
||||
|
||||
/**
|
||||
* @brief The no op test is an empty test used to measure the performance framework alone.
|
||||
@ -45,7 +45,7 @@ namespace Azure { namespace Perf { namespace Test {
|
||||
*/
|
||||
std::vector<Azure::Perf::TestOption> GetTestOptions() override
|
||||
{
|
||||
return {{"extraOption", {"-e"}, "Example for extended option for test.", 1}};
|
||||
return {{"extraOption", {"--e"}, "Example for extended option for test.", 1}};
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,9 +59,9 @@ namespace Azure { namespace Perf { namespace Test {
|
||||
"NoOp",
|
||||
"Simplest test to measure the performance framework speed.",
|
||||
[](Azure::Perf::TestOptions options) {
|
||||
return std::make_unique<Azure::Perf::Test::NoOp>(options);
|
||||
return std::make_unique<Azure::Core::Test::NoOp>(options);
|
||||
}};
|
||||
}
|
||||
};
|
||||
|
||||
}}} // namespace Azure::Perf::Test
|
||||
}}} // namespace Azure::Core::Test
|
||||
@ -61,7 +61,7 @@ namespace Azure { namespace Core { namespace Test {
|
||||
static Azure::Perf::TestMetadata GetTestMetadata()
|
||||
{
|
||||
return {
|
||||
"NullableTest",
|
||||
"nullable",
|
||||
"Measures the overhead of using nullable objects",
|
||||
[](Azure::Perf::TestOptions options) {
|
||||
return std::make_unique<Azure::Core::Test::NullableTest>(options);
|
||||
|
||||
@ -189,7 +189,7 @@ namespace Azure { namespace Core { namespace Test {
|
||||
static Azure::Perf::TestMetadata GetTestMetadata()
|
||||
{
|
||||
return {
|
||||
"PipelineBaseTest",
|
||||
"pipelineBase",
|
||||
"Measures HTTP pipeline and policies performance",
|
||||
[](Azure::Perf::TestOptions options) {
|
||||
return std::make_unique<Azure::Core::Test::PipelineTest>(options);
|
||||
|
||||
@ -48,7 +48,7 @@ namespace Azure { namespace Core { namespace Test {
|
||||
*/
|
||||
std::vector<Azure::Perf::TestOption> GetTestOptions() override
|
||||
{
|
||||
return {{"count", {"-c"}, "The number of uuid objects to be created.", 1, true}};
|
||||
return {{"count", {"--c"}, "The number of uuid objects to be created.", 1, true}};
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,7 +59,7 @@ namespace Azure { namespace Core { namespace Test {
|
||||
static Azure::Perf::TestMetadata GetTestMetadata()
|
||||
{
|
||||
return {
|
||||
"UuidTest",
|
||||
"uuid",
|
||||
"Measures the overhead of using Uuid objects",
|
||||
[](Azure::Perf::TestOptions options) {
|
||||
return std::make_unique<Azure::Core::Test::UuidTest>(options);
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "azure/core/test/delay_test.hpp"
|
||||
#include "azure/core/test/exception_test.hpp"
|
||||
#include "azure/core/test/extended_options_test.hpp"
|
||||
#include "azure/core/test/http_transport_test.hpp"
|
||||
#include "azure/core/test/json_test.hpp"
|
||||
#include "azure/core/test/no_op_test.hpp"
|
||||
#include "azure/core/test/nullable_test.hpp"
|
||||
#include "azure/core/test/pipeline_test.hpp"
|
||||
#include "azure/core/test/uuid_test.hpp"
|
||||
@ -16,8 +20,12 @@ int main(int argc, char** argv)
|
||||
|
||||
// Create the test list
|
||||
std::vector<Azure::Perf::TestMetadata> tests{
|
||||
Azure::Core::Test::DelayTest::GetTestMetadata(),
|
||||
Azure::Core::Test::ExceptionTest::GetTestMetadata(),
|
||||
Azure::Core::Test::ExtendedOptionsTest::GetTestMetadata(),
|
||||
Azure::Core::Test::HTTPTransportTest::GetTestMetadata(),
|
||||
Azure::Core::Test::JsonTest::GetTestMetadata(),
|
||||
Azure::Core::Test::NoOp::GetTestMetadata(),
|
||||
Azure::Core::Test::NullableTest::GetTestMetadata(),
|
||||
Azure::Core::Test::PipelineTest::GetTestMetadata(),
|
||||
Azure::Core::Test::UuidTest::GetTestMetadata()};
|
||||
|
||||
@ -1,13 +1,44 @@
|
||||
Service: core
|
||||
|
||||
Project: azure-perf-test
|
||||
Project: azure-core-perf
|
||||
|
||||
PackageVersions:
|
||||
- azure-core-cpp: 1.7.2
|
||||
- azure-core-cpp: 1.11.0
|
||||
- azure-core-cpp: source
|
||||
|
||||
Tests:
|
||||
- Test: delay
|
||||
Class: delay
|
||||
Arguments:
|
||||
- --m 100 --n 1000 --t 500
|
||||
|
||||
- Test: exception
|
||||
Class: exception
|
||||
Arguments:
|
||||
- --e 1
|
||||
|
||||
- Test: extendedOptions
|
||||
Class: extendedOptions
|
||||
Arguments:
|
||||
- -e 1
|
||||
- --e 1
|
||||
|
||||
- Test: json
|
||||
Class: json
|
||||
Arguments:
|
||||
- --action serialize --size 1000
|
||||
- --action deserialize --size 1000
|
||||
|
||||
- Test: noOp
|
||||
Class: noOp
|
||||
Arguments:
|
||||
- --e 1
|
||||
|
||||
- Test: nullable
|
||||
Class: nullable
|
||||
Arguments:
|
||||
- --e 1
|
||||
|
||||
- Test: uuid
|
||||
Class: uuid
|
||||
Arguments:
|
||||
- --c 1
|
||||
|
||||
@ -6,7 +6,7 @@ parameters:
|
||||
- name: Tests
|
||||
displayName: Tests (regex of tests to run)
|
||||
type: string
|
||||
default: '^(extendedOptions)$'
|
||||
default: '^(delay|exception|extendedOptions|json|noop|nullable|uuid)$'
|
||||
- name: Arguments
|
||||
displayName: Arguments (regex of arguments to run)
|
||||
type: string
|
||||
|
||||
@ -127,7 +127,11 @@ namespace Azure { namespace Perf {
|
||||
*/
|
||||
virtual std::vector<Azure::Perf::TestOption> GetTestOptions()
|
||||
{
|
||||
return std::vector<Azure::Perf::TestOption>();
|
||||
return {
|
||||
{"extraOption",
|
||||
{"--e"},
|
||||
"Example for extended option for test.Needed to be run by the perf tool.",
|
||||
1}};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -3,42 +3,10 @@
|
||||
|
||||
# Configure CMake project.
|
||||
cmake_minimum_required (VERSION 3.13)
|
||||
project(azure-perf-test LANGUAGES CXX)
|
||||
project(azure-perf-unit-test LANGUAGES CXX)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
set(
|
||||
AZURE_PERF_TEST_HEADER
|
||||
inc/azure/perf/test/curl_http_client_get_test.hpp
|
||||
inc/azure/perf/test/delay_test.hpp
|
||||
inc/azure/perf/test/exception_test.hpp
|
||||
inc/azure/perf/test/extended_options_test.hpp
|
||||
inc/azure/perf/test/http_client_get_test.hpp
|
||||
inc/azure/perf/test/http_pipeline_get_test.hpp
|
||||
inc/azure/perf/test/no_op_test.hpp
|
||||
inc/azure/perf/test/win_http_client_get_test.hpp
|
||||
)
|
||||
|
||||
set(
|
||||
AZURE_PERF_TEST_SOURCE
|
||||
src/perf_test.cpp
|
||||
)
|
||||
|
||||
# Name the binary to be created.
|
||||
add_executable (
|
||||
azure-perf-test
|
||||
${AZURE_PERF_TEST_HEADER} ${AZURE_PERF_TEST_SOURCE}
|
||||
)
|
||||
|
||||
create_map_file(azure-perf-test azure-perf-test.map)
|
||||
|
||||
# Include the headers from the project.
|
||||
target_include_directories(
|
||||
azure-perf-test
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc>
|
||||
)
|
||||
|
||||
if(DEFINED ENV{VCPKG-AZURE-CORE-CPP})
|
||||
find_package(azure-core-cpp $ENV{VCPKG-AZURE-CORE-CPP} EXACT)
|
||||
add_compile_definitions(VCPKG_CORE_VERSION="$ENV{VCPKG-AZURE-CORE-CPP}")
|
||||
@ -46,12 +14,6 @@ else()
|
||||
add_compile_definitions(VCPKG_CORE_VERSION="source")
|
||||
endif()
|
||||
|
||||
|
||||
# link the `azure-perf` lib together with any other library which will be used for the tests.
|
||||
target_link_libraries(azure-perf-test PRIVATE Azure::azure-core azure-perf)
|
||||
# Make sure the project will appear in the test folder for Visual Studio CMake view
|
||||
set_target_properties(azure-perf-test PROPERTIES FOLDER "Tests/Core")
|
||||
|
||||
# Unit tests
|
||||
include(GoogleTest)
|
||||
|
||||
|
||||
@ -1,58 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief An example of a performance test that defines a test option.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "azure/perf/test/http_client_get_test.hpp"
|
||||
|
||||
#include <azure/core/http/curl_transport.hpp>
|
||||
|
||||
namespace Azure { namespace Perf { namespace Test {
|
||||
/**
|
||||
* @brief A performance test that defines a test option.
|
||||
*
|
||||
*/
|
||||
class CurlHttpClientGetTest : public Azure::Perf::Test::HttpClientGetTest {
|
||||
private:
|
||||
Azure::Core::Url m_url;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Extended Options Test object.
|
||||
*
|
||||
* @param options The command-line parsed options.
|
||||
*/
|
||||
CurlHttpClientGetTest(Azure::Perf::TestOptions options) : HttpClientGetTest(options) {}
|
||||
|
||||
/**
|
||||
* @brief Set up the HTTP client
|
||||
*
|
||||
*/
|
||||
void GlobalSetup() override
|
||||
{
|
||||
m_httpClient = std::make_unique<Azure::Core::Http::CurlTransport>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the static Test Metadata for the test.
|
||||
*
|
||||
* @return Azure::Perf::TestMetadata describing the test.
|
||||
*/
|
||||
static Azure::Perf::TestMetadata GetTestMetadata()
|
||||
{
|
||||
return {
|
||||
"curlHttpClientGet",
|
||||
"Send an HTTP GET request to a configurable URL using libcurl.",
|
||||
[](Azure::Perf::TestOptions options) {
|
||||
return std::make_unique<Azure::Perf::Test::CurlHttpClientGetTest>(options);
|
||||
}};
|
||||
}
|
||||
};
|
||||
|
||||
}}} // namespace Azure::Perf::Test
|
||||
@ -1,75 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief An example of a performance test that defines a test option.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <azure/core/http/http.hpp>
|
||||
#include <azure/core/http/transport.hpp>
|
||||
#include <azure/core/io/body_stream.hpp>
|
||||
#include <azure/perf.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace Azure { namespace Perf { namespace Test {
|
||||
|
||||
/**
|
||||
* @brief A performance test that defines a test option.
|
||||
*
|
||||
*/
|
||||
class HttpClientGetTest : public Azure::Perf::PerfTest {
|
||||
protected:
|
||||
Azure::Core::Url m_url;
|
||||
static std::unique_ptr<Azure::Core::Http::HttpTransport> m_httpClient;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Extended Options Test object.
|
||||
*
|
||||
* @param options The command-line parsed options.
|
||||
*/
|
||||
HttpClientGetTest(Azure::Perf::TestOptions options) : PerfTest(options) {}
|
||||
|
||||
/**
|
||||
* @brief Get and set the URL option
|
||||
*
|
||||
*/
|
||||
void Setup() override
|
||||
{
|
||||
m_url = Azure::Core::Url(m_options.GetMandatoryOption<std::string>("url"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief The test definition
|
||||
*
|
||||
* @param ctx The cancellation token.
|
||||
*/
|
||||
void Run(Azure::Core::Context const& ctx) override
|
||||
{
|
||||
Azure::Core::Http::Request request(Azure::Core::Http::HttpMethod::Get, m_url);
|
||||
auto response = m_httpClient->Send(request, ctx);
|
||||
// Read the body from network
|
||||
auto bodyStream = response->ExtractBodyStream();
|
||||
response->SetBody(bodyStream->ReadToEnd(ctx));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Define the test options for the test.
|
||||
*
|
||||
* @return The list of test options.
|
||||
*/
|
||||
std::vector<Azure::Perf::TestOption> GetTestOptions() override
|
||||
{
|
||||
return {{"url", {"--url"}, "Url to send the HTTP request. *Required parameter.", 1, true}};
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<Azure::Core::Http::HttpTransport> HttpClientGetTest::m_httpClient;
|
||||
|
||||
}}} // namespace Azure::Perf::Test
|
||||
@ -1,98 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Performance test measuring the use of an HTTP pipeline (and optionally test proxy).
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <azure/core/http/http.hpp>
|
||||
#include <azure/core/http/transport.hpp>
|
||||
#include <azure/core/internal/http/pipeline.hpp>
|
||||
#include <azure/core/io/body_stream.hpp>
|
||||
#include <azure/perf.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace Azure { namespace Perf { namespace Test {
|
||||
|
||||
/**
|
||||
* @brief A performance test that defines a test option.
|
||||
*
|
||||
*/
|
||||
class HttpPipelineGetTest : public Azure::Perf::PerfTest {
|
||||
Azure::Core::Url m_url;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Extended Options Test object.
|
||||
*
|
||||
* @param options The command-line parsed options.
|
||||
*/
|
||||
HttpPipelineGetTest(Azure::Perf::TestOptions options) : PerfTest(options) {}
|
||||
|
||||
/**
|
||||
* @brief Get and set the URL option
|
||||
*
|
||||
*/
|
||||
void Setup() override
|
||||
{
|
||||
m_url = Azure::Core::Url(m_options.GetMandatoryOption<std::string>("url"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set up the HTTP client
|
||||
*
|
||||
*/
|
||||
void GlobalSetup() override {}
|
||||
|
||||
/**
|
||||
* @brief Get the static Test Metadata for the test.
|
||||
*
|
||||
* @return Azure::Perf::TestMetadata describing the test.
|
||||
*/
|
||||
static Azure::Perf::TestMetadata GetTestMetadata()
|
||||
{
|
||||
return {
|
||||
"httpPipelineGet",
|
||||
"Send an HTTP GET request to a configurable URL using Azure Pipelines.",
|
||||
[](Azure::Perf::TestOptions options) {
|
||||
return std::make_unique<Azure::Perf::Test::HttpPipelineGetTest>(options);
|
||||
}};
|
||||
}
|
||||
/**
|
||||
* @brief Define the test options for the test.
|
||||
*
|
||||
* @return The list of test options.
|
||||
*/
|
||||
std::vector<Azure::Perf::TestOption> GetTestOptions() override
|
||||
{
|
||||
return {{"url", {"--url"}, "Url to send the HTTP request. *Required parameter.", 1, true}};
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief The test definition
|
||||
*
|
||||
* @param ctx The cancellation token.
|
||||
*/
|
||||
void Run(Azure::Core::Context const& ctx) override
|
||||
{
|
||||
Azure::Core::_internal::ClientOptions clientOptions;
|
||||
|
||||
ConfigureClientOptions(clientOptions);
|
||||
std::vector<std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy>> perRequest;
|
||||
std::vector<std::unique_ptr<Azure::Core::Http::Policies::HttpPolicy>> perRetry;
|
||||
Azure::Core::Http::_internal::HttpPipeline pipeline(
|
||||
clientOptions, "PipelineTest", "na", std::move(perRequest), std::move(perRetry));
|
||||
|
||||
Azure::Core::Http::Request request(Azure::Core::Http::HttpMethod::Get, m_url);
|
||||
auto response = pipeline.Send(request, ctx);
|
||||
response->GetBody();
|
||||
}
|
||||
};
|
||||
|
||||
}}} // namespace Azure::Perf::Test
|
||||
@ -1,56 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief An example of a performance test that defines a test option.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "azure/perf/test/http_client_get_test.hpp"
|
||||
|
||||
#include <azure/core/http/win_http_transport.hpp>
|
||||
|
||||
namespace Azure { namespace Perf { namespace Test {
|
||||
|
||||
/**
|
||||
* @brief A performance test that defines a test option.
|
||||
*
|
||||
*/
|
||||
class WinHttpClientGetTest : public Azure::Perf::Test::HttpClientGetTest {
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Extended Options Test object.
|
||||
*
|
||||
* @param options The command-line parsed options.
|
||||
*/
|
||||
WinHttpClientGetTest(Azure::Perf::TestOptions options) : HttpClientGetTest(options) {}
|
||||
|
||||
/**
|
||||
* @brief Set up the HTTP client
|
||||
*
|
||||
*/
|
||||
void GlobalSetup() override
|
||||
{
|
||||
m_httpClient = std::make_unique<Azure::Core::Http::WinHttpTransport>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the static Test Metadata for the test.
|
||||
*
|
||||
* @return Azure::Perf::TestMetadata describing the test.
|
||||
*/
|
||||
static Azure::Perf::TestMetadata GetTestMetadata()
|
||||
{
|
||||
return {
|
||||
"winHttpClientGet",
|
||||
"Send an HTTP GET request to a configurable URL using WinHTTP.",
|
||||
[](Azure::Perf::TestOptions options) {
|
||||
return std::make_unique<Azure::Perf::Test::WinHttpClientGetTest>(options);
|
||||
}};
|
||||
}
|
||||
};
|
||||
|
||||
}}} // namespace Azure::Perf::Test
|
||||
@ -1,43 +0,0 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "azure/perf/test/delay_test.hpp"
|
||||
#include "azure/perf/test/extended_options_test.hpp"
|
||||
#include "azure/perf/test/http_pipeline_get_test.hpp"
|
||||
|
||||
#include <azure/perf.hpp>
|
||||
#if defined(BUILD_CURL_HTTP_TRANSPORT_ADAPTER)
|
||||
#include "azure/perf/test/curl_http_client_get_test.hpp"
|
||||
#endif
|
||||
#if defined(BUILD_TRANSPORT_WINHTTP_ADAPTER)
|
||||
#include "azure/perf/test/win_http_client_get_test.hpp"
|
||||
#endif
|
||||
#include "azure/perf/test/exception_test.hpp"
|
||||
#include "azure/perf/test/no_op_test.hpp"
|
||||
|
||||
#include <vector>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::cout << "AZURE-CORE-CPP VERSION " << VCPKG_CORE_VERSION << std::endl;
|
||||
// Create the test list
|
||||
std::vector<Azure::Perf::TestMetadata> tests{
|
||||
Azure::Perf::Test::NoOp::GetTestMetadata(),
|
||||
Azure::Perf::Test::ExtendedOptionsTest::GetTestMetadata(),
|
||||
Azure::Perf::Test::DelayTest::GetTestMetadata(),
|
||||
Azure::Perf::Test::ExceptionTest::GetTestMetadata(),
|
||||
Azure::Perf::Test::HttpPipelineGetTest::GetTestMetadata(),
|
||||
};
|
||||
|
||||
#if defined(BUILD_CURL_HTTP_TRANSPORT_ADAPTER)
|
||||
tests.emplace_back(Azure::Perf::Test::CurlHttpClientGetTest::GetTestMetadata());
|
||||
#endif
|
||||
|
||||
#if defined(BUILD_TRANSPORT_WINHTTP_ADAPTER)
|
||||
tests.emplace_back(Azure::Perf::Test::WinHttpClientGetTest::GetTestMetadata());
|
||||
#endif
|
||||
|
||||
Azure::Perf::Program::Run(Azure::Core::Context::ApplicationContext, tests, argc, argv);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user