1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
import os
from devtools_testutils.perfstress_tests import PerfStressTest
from azure.appconfiguration import ConfigurationSetting, AzureAppConfigurationClient as SyncAppConfigClient
from azure.appconfiguration.aio import AzureAppConfigurationClient as AsyncAppConfigClient
class GetTest(PerfStressTest):
def __init__(self, arguments):
super().__init__(arguments)
connection_string = self.get_from_env("AZURE_APP_CONFIG_CONNECTION_STRING")
self.key = "KEY"
self.service_client = SyncAppConfigClient.from_connection_string(connection_string=connection_string)
self.async_service_client = AsyncAppConfigClient.from_connection_string(connection_string=connection_string)
async def global_setup(self):
await super().global_setup()
kv = ConfigurationSetting(
key=self.key,
value="VALUE",
)
await self.async_service_client.set_configuration_setting(kv)
async def close(self):
# await self.async_service_client.close()
await super().close()
def run_sync(self):
self.service_client.get_configuration_setting(key=self.key)
async def run_async(self):
await self.async_service_client.get_configuration_setting(key=self.key)
|