Skip to content

Commit

Permalink
Add AppConfiguration perf test (#19270)
Browse files Browse the repository at this point in the history
  • Loading branch information
pakrym authored Mar 5, 2021
1 parent 2217631 commit e9171bf
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 0 deletions.
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);

0 comments on commit e9171bf

Please sign in to comment.