Skip to content

Commit e9171bf

Browse files
authored
Add AppConfiguration perf test (Azure#19270)
1 parent 2217631 commit e9171bf

File tree

5 files changed

+104
-0
lines changed

5 files changed

+104
-0
lines changed

sdk/appconfiguration/Azure.Data.AppConfiguration/Azure.Data.AppConfiguration.sln

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Identity", "..\..\ide
1515
EndProject
1616
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{1FC8A3EA-3C0D-4DDF-B710-A7091F2CEBB1}"
1717
EndProject
18+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Data.AppConfiguration.Perf", "perf\Azure.Data.AppConfiguration.Perf.csproj", "{034EF1C7-2953-49FD-BC45-9C3FF5986883}"
19+
EndProject
20+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Test.Perf", "..\..\..\common\Perf\Azure.Test.Perf\Azure.Test.Perf.csproj", "{676CF11A-2788-478F-ABBA-0CD79CF60BE3}"
21+
EndProject
1822
Global
1923
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2024
Debug|Any CPU = Debug|Any CPU
@@ -45,6 +49,14 @@ Global
4549
{1FC8A3EA-3C0D-4DDF-B710-A7091F2CEBB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
4650
{1FC8A3EA-3C0D-4DDF-B710-A7091F2CEBB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
4751
{1FC8A3EA-3C0D-4DDF-B710-A7091F2CEBB1}.Release|Any CPU.Build.0 = Release|Any CPU
52+
{034EF1C7-2953-49FD-BC45-9C3FF5986883}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
53+
{034EF1C7-2953-49FD-BC45-9C3FF5986883}.Debug|Any CPU.Build.0 = Debug|Any CPU
54+
{034EF1C7-2953-49FD-BC45-9C3FF5986883}.Release|Any CPU.ActiveCfg = Release|Any CPU
55+
{034EF1C7-2953-49FD-BC45-9C3FF5986883}.Release|Any CPU.Build.0 = Release|Any CPU
56+
{676CF11A-2788-478F-ABBA-0CD79CF60BE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
57+
{676CF11A-2788-478F-ABBA-0CD79CF60BE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
58+
{676CF11A-2788-478F-ABBA-0CD79CF60BE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
59+
{676CF11A-2788-478F-ABBA-0CD79CF60BE3}.Release|Any CPU.Build.0 = Release|Any CPU
4860
EndGlobalSection
4961
GlobalSection(SolutionProperties) = preSolution
5062
HideSolutionNode = FALSE
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<ProjectReference Include="..\..\..\..\common\Perf\Azure.Test.Perf\Azure.Test.Perf.csproj" />
9+
<ProjectReference Include="..\src\Azure.Data.AppConfiguration.csproj" />
10+
<ProjectReference Include="$(AzureCoreTestFramework)" />
11+
</ItemGroup>
12+
13+
</Project>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
//Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using System;
5+
using System.Threading;
6+
using System.Threading.Tasks;
7+
using Azure.Test.Perf;
8+
9+
namespace Azure.Data.AppConfiguration.Perf
10+
{
11+
/// <summary>
12+
/// The performance test scenario focused on listing App Configuration settings.
13+
/// </summary>
14+
public sealed class GetConfigurationSettings : PerfTest<CountOptions>
15+
{
16+
private static string _prefix = Guid.NewGuid().ToString("N");
17+
private static SettingSelector _filter = new SettingSelector() { KeyFilter = _prefix + "*" };
18+
19+
private readonly ConfigurationClient _configurationClient;
20+
21+
public GetConfigurationSettings(CountOptions options) : base(options)
22+
{
23+
_configurationClient = new ConfigurationClient(PerfTestEnvironment.Instance.ConnectionString);
24+
}
25+
26+
public override async Task GlobalSetupAsync()
27+
{
28+
await base.GlobalSetupAsync();
29+
30+
for (int i = 0; i < Options.Count; i++)
31+
{
32+
await _configurationClient.SetConfigurationSettingAsync(_prefix + i, i.ToString());
33+
}
34+
}
35+
36+
public override void Run(CancellationToken cancellationToken)
37+
{
38+
foreach (var _ in _configurationClient.GetConfigurationSettings(_filter))
39+
{
40+
}
41+
}
42+
43+
public override async Task RunAsync(CancellationToken cancellationToken)
44+
{
45+
await foreach (var _ in _configurationClient.GetConfigurationSettingsAsync(_filter))
46+
{
47+
}
48+
}
49+
50+
public override async Task GlobalCleanupAsync()
51+
{
52+
await foreach (var setting in _configurationClient.GetConfigurationSettingsAsync(_filter))
53+
{
54+
await _configurationClient.DeleteConfigurationSettingAsync(setting);
55+
}
56+
}
57+
}
58+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using Azure.Core.TestFramework;
5+
6+
namespace Azure.Data.AppConfiguration.Perf
7+
{
8+
public sealed class PerfTestEnvironment : TestEnvironment
9+
{
10+
public string ConnectionString => GetVariable("APPCONFIGURATION_CONNECTION_STRING");
11+
12+
public static PerfTestEnvironment Instance { get; } = new ();
13+
}
14+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using System.Reflection;
5+
using Azure.Test.Perf;
6+
7+
await PerfProgram.Main(Assembly.GetEntryAssembly(), args);

0 commit comments

Comments
 (0)