-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add AppConfiguration perf test (#19270)
- Loading branch information
Showing
5 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...appconfiguration/Azure.Data.AppConfiguration/perf/Azure.Data.AppConfiguration.Perf.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
58 changes: 58 additions & 0 deletions
58
sdk/appconfiguration/Azure.Data.AppConfiguration/perf/GetConfigurationSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
sdk/appconfiguration/Azure.Data.AppConfiguration/perf/PerfTestEnvironment.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 (); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
sdk/appconfiguration/Azure.Data.AppConfiguration/perf/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |