Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AppConfiguration perf test #19270

Merged
merged 2 commits into from
Mar 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Identity", "..\..\ide
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{1FC8A3EA-3C0D-4DDF-B710-A7091F2CEBB1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Data.AppConfiguration.Perf", "perf\Azure.Data.AppConfiguration.Perf.csproj", "{034EF1C7-2953-49FD-BC45-9C3FF5986883}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Test.Perf", "..\..\..\common\Perf\Azure.Test.Perf\Azure.Test.Perf.csproj", "{676CF11A-2788-478F-ABBA-0CD79CF60BE3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -45,6 +49,14 @@ Global
{1FC8A3EA-3C0D-4DDF-B710-A7091F2CEBB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1FC8A3EA-3C0D-4DDF-B710-A7091F2CEBB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1FC8A3EA-3C0D-4DDF-B710-A7091F2CEBB1}.Release|Any CPU.Build.0 = Release|Any CPU
{034EF1C7-2953-49FD-BC45-9C3FF5986883}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{034EF1C7-2953-49FD-BC45-9C3FF5986883}.Debug|Any CPU.Build.0 = Debug|Any CPU
{034EF1C7-2953-49FD-BC45-9C3FF5986883}.Release|Any CPU.ActiveCfg = Release|Any CPU
{034EF1C7-2953-49FD-BC45-9C3FF5986883}.Release|Any CPU.Build.0 = Release|Any CPU
{676CF11A-2788-478F-ABBA-0CD79CF60BE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{676CF11A-2788-478F-ABBA-0CD79CF60BE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{676CF11A-2788-478F-ABBA-0CD79CF60BE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{676CF11A-2788-478F-ABBA-0CD79CF60BE3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\common\Perf\Azure.Test.Perf\Azure.Test.Perf.csproj" />
<ProjectReference Include="..\src\Azure.Data.AppConfiguration.csproj" />
<ProjectReference Include="$(AzureCoreTestFramework)" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Threading;
using System.Threading.Tasks;
using Azure.Test.Perf;

namespace Azure.Data.AppConfiguration.Perf
{
/// <summary>
/// The performance test scenario focused on listing App Configuration settings.
/// </summary>
public sealed class GetConfigurationSettings : PerfTest<CountOptions>
{
private static string _prefix = Guid.NewGuid().ToString("N");
private static SettingSelector _filter = new SettingSelector() { KeyFilter = _prefix + "*" };

private readonly ConfigurationClient _configurationClient;

public GetConfigurationSettings(CountOptions options) : base(options)
{
_configurationClient = new ConfigurationClient(PerfTestEnvironment.Instance.ConnectionString);
}

public override async Task GlobalSetupAsync()
{
await base.GlobalSetupAsync();

for (int i = 0; i < Options.Count; i++)
{
await _configurationClient.SetConfigurationSettingAsync(_prefix + i, i.ToString());
}
}

public override void Run(CancellationToken cancellationToken)
{
foreach (var _ in _configurationClient.GetConfigurationSettings(_filter))
{
}
}

public override async Task RunAsync(CancellationToken cancellationToken)
{
await foreach (var _ in _configurationClient.GetConfigurationSettingsAsync(_filter))
{
}
}

public override async Task GlobalCleanupAsync()
{
await foreach (var setting in _configurationClient.GetConfigurationSettingsAsync(_filter))
{
await _configurationClient.DeleteConfigurationSettingAsync(setting);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using Azure.Core.TestFramework;

namespace Azure.Data.AppConfiguration.Perf
{
public sealed class PerfTestEnvironment : TestEnvironment
{
public string ConnectionString => GetVariable("APPCONFIGURATION_CONNECTION_STRING");

public static PerfTestEnvironment Instance { get; } = new ();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System.Reflection;
using Azure.Test.Perf;

await PerfProgram.Main(Assembly.GetEntryAssembly(), args);