Step 1 in adding (more)perf tests for Core and Identity. (#5300)

* mroe quotes

* dssf

* sqa

* first identity test no caching

* cache no cache

* cleanup cache shortcircuit

* some cleanup

* Update sdk/core/perf/src/base_test.cpp

Co-authored-by: Anton Kolesnyk <41349689+antkmsft@users.noreply.github.com>

* PR comments

* remove cache option

* wqq

* dsd

* saa

* wqq

* clang

* Update sdk/core/perf/inc/azure/perf/dynamic_test_options.hpp

Co-authored-by: Anton Kolesnyk <41349689+antkmsft@users.noreply.github.com>

* PR comments

* PT comments

* clang

---------

Co-authored-by: Anton Kolesnyk <41349689+antkmsft@users.noreply.github.com>
This commit is contained in:
George Arama 2024-02-01 10:47:02 -08:00 committed by GitHub
parent c2f189695c
commit 070c7e94db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 21 additions and 8 deletions

View File

@ -51,7 +51,15 @@ namespace Azure { namespace Perf {
*
* @param proxy A test-proxy server url.
*/
void SetTestProxy(std::string const& proxy) { m_proxy = proxy; }
void SetTestProxy(std::string const& proxy)
{
if (!proxy.empty())
{
// we need to allow for certificate verification failures due to presence of test proxy.
m_isInsecureEnabled = true;
m_proxy = proxy;
}
}
/**
* @brief Set the performance test to run insecure.

View File

@ -137,7 +137,6 @@ namespace Azure { namespace Perf {
void BaseTest::PostSetUp()
{
if (!m_proxy.empty())
{
Azure::Core::_internal::ClientOptions clientOp;
@ -192,7 +191,6 @@ namespace Azure { namespace Perf {
Azure::Core::Http::Request request(Azure::Core::Http::HttpMethod::Post, startPlayback);
request.SetHeader("x-recording-id", m_recordId);
auto response = pipeline.Send(request, ctx);
auto const& headers = response->GetHeaders();
auto findHeader = std::find_if(
headers.begin(),

View File

@ -65,6 +65,7 @@ std::vector<Azure::Perf::TestOption> Azure::Perf::GlobalTestOptions::GetOptionMe
{"-d", "--duration"},
"Duration of the test in seconds. Default to 10 seconds.",
1},
{"help", {"-h", "--help"}, "Display help information.", 0},
{"Host", {"--host"}, "Host to redirect HTTP requests. No redirection by default.", 1},
{"Insecure", {"--insecure"}, "Allow untrusted SSL certs. Default to false.", 0},
{"Iterations",
@ -83,8 +84,9 @@ std::vector<Azure::Perf::TestOption> Azure::Perf::GlobalTestOptions::GetOptionMe
1},
{"Port", {"--port"}, "Port to redirect HTTP requests. Default to no redirection.", 1},
{"Rate", {"-r", "--rate"}, "Target throughput (ops/sec). Default to no throughput.", 1},
{"Warmup", {"-w", "--warmup"}, "Duration of warmup in seconds. Default to 5 seconds.", 1},
{"Sync", {"-y", "--sync"}, "Runs sync version of test, not implemented", 0},
{"TestProxies", {"-x", "--test-proxies"}, "URIs of TestProxy Servers (separated by ';')", 1},
{"help", {"-h", "--help"}, "Display help information.", 0},
{"Sync", {"-y", "--sync"}, "Runs sync version of test, not implemented", 0}};
{"Warmup", {"-w", "--warmup"}, "Duration of warmup in seconds. Default to 5 seconds.", 1},
};
}

View File

@ -41,6 +41,10 @@ namespace Azure { namespace Identity { namespace Test {
m_clientId = m_options.GetMandatoryOption<std::string>("ClientId");
m_secret = m_options.GetMandatoryOption<std::string>("Secret");
m_tokenRequestContext.Scopes.push_back(m_options.GetMandatoryOption<std::string>("Scope"));
if (!m_options.GetOptionOrDefault<bool>("Cache", false))
{
m_tokenRequestContext.MinimumExpiration = std::chrono::hours(1000000);
}
m_credential = std::make_unique<Azure::Identity::ClientSecretCredential>(
m_tenantId,
m_clientId,
@ -73,10 +77,11 @@ namespace Azure { namespace Identity { namespace Test {
std::vector<Azure::Perf::TestOption> GetTestOptions() override
{
return {
{"TenantId", {"--tenantId"}, "The tenant Id for the authentication.", 1, true},
{"Cache", {"--cache"}, "Use credential cache.", 1, false},
{"ClientId", {"--clientId"}, "The client Id for the authentication.", 1, true},
{"Scope", {"--scope"}, "One scope to request access to.", 1, true},
{"Secret", {"--secret"}, "The secret for authentication.", 1, true, true},
{"Scope", {"--scope"}, "One scope to request access to.", 1, true}};
{"TenantId", {"--tenantId"}, "The tenant Id for the authentication.", 1, true}};
}
/**