Skip to content

App Config - Connection String testing#45859

Open
mrm9084 wants to merge 10 commits intoAzure:mainfrom
mrm9084:RemoveDupConnectionStringTests
Open

App Config - Connection String testing#45859
mrm9084 wants to merge 10 commits intoAzure:mainfrom
mrm9084:RemoveDupConnectionStringTests

Conversation

@mrm9084
Copy link
Member

@mrm9084 mrm9084 commented Mar 23, 2026

Description

Currently the only difference between Entra ID and Connection string in python is this method:

def from_connection_string(cls, connection_string: str, **kwargs: Any) -> "AzureAppConfigurationClient":
"""Create AzureAppConfigurationClient from a Connection String.
:param str connection_string: Connection String
(one of the access keys of the Azure App Configuration resource)
used to access the Azure App Configuration.
:return: An AzureAppConfigurationClient authenticated with the connection string
:rtype: ~azure.appconfiguration.AzureAppConfigurationClient
Example
.. code-block:: python
from azure.appconfiguration import AzureAppConfigurationClient
connection_str = "<my connection string>"
client = AzureAppConfigurationClient.from_connection_string(connection_str)
"""
endpoint, id_credential, secret = parse_connection_string(connection_string)
# AzureKeyCredential type is for internal use, it's not exposed in public API.
return cls(
credential=AzureKeyCredential(secret), # type: ignore[arg-type]
base_url=endpoint,
id_credential=id_credential,
**kwargs,
)

which makes a token type that is then used the same as Entra ID tokens. We don't need duplicate tests everywhere for connection string.

  • I've moved all tests to be Entra ID
  • Removed any duplicate tests in connection string files
  • Now connection string testing is actual unit testing.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copilot AI review requested due to automatic review settings March 23, 2026 21:39
@github-actions github-actions bot added the App Configuration Azure.ApplicationModel.Configuration label Mar 23, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Azure App Configuration Python test suite to reduce duplicated coverage between connection-string auth and Microsoft Entra ID auth, shifting most live tests to Entra ID and keeping connection-string validation primarily as unit tests.

Changes:

  • Updated test case helpers to set up data using Entra ID clients and removed connection-string-specific helper paths.
  • Removed large connection-string live test suites and added focused unit tests for from_connection_string behavior (sync + async).
  • Updated perf stress tests and documentation to use an endpoint + DefaultAzureCredential instead of a connection string.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
sdk/appconfiguration/azure-appconfiguration/tests/testcase.py Simplifies setup to Entra ID, removes connection-string helper methods.
sdk/appconfiguration/azure-appconfiguration/tests/asynctestcase.py Aligns async test helper creation/setup with Entra ID path.
sdk/appconfiguration/azure-appconfiguration/tests/test_consistency.py Switches live consistency tests from connection string env var to endpoint env var.
sdk/appconfiguration/azure-appconfiguration/tests/test_azure_appconfiguration_client.py Removes connection-string live tests; adds unit tests for from_connection_string.
sdk/appconfiguration/azure-appconfiguration/tests/test_azure_appconfiguration_client_async.py Removes connection-string live tests; adds async unit tests for from_connection_string.
sdk/appconfiguration/azure-appconfiguration/tests/test_azure_appconfiguration_client_aad.py Updates live tests to use the unified client creation path and adds additional test coverage.
sdk/appconfiguration/azure-appconfiguration/tests/test_azure_appconfiguration_client_aad_async.py Updates live async tests similarly and adds coverage for additional behaviors.
sdk/appconfiguration/azure-appconfiguration/tests/test_audience_error_handling_live.py Updates audience live tests to use the unified client creation path.
sdk/appconfiguration/azure-appconfiguration/tests/test_audience_error_handling_live_async.py Updates async audience live tests to use the unified client creation path.
sdk/appconfiguration/azure-appconfiguration/tests/perfstress_tests/get.py Switches perf test auth to Entra ID via endpoint + DefaultAzureCredential.
sdk/appconfiguration/azure-appconfiguration/tests/perfstress_tests/set.py Switches perf test auth to Entra ID via endpoint + DefaultAzureCredential.
sdk/appconfiguration/azure-appconfiguration/tests/perfstress_tests/README.md Updates perf test required env var from connection string to endpoint.
sdk/appconfiguration/azure-appconfiguration/assets.json Updates recorded assets tag reference.

Comment on lines +1224 to +1231
class TestAppConfigurationClientAADUnitTest:
def test_type_error(self):
with pytest.raises(TypeError):
_ = FeatureFlagConfigurationSetting("blah", value="blah")
with pytest.raises(TypeError):
_ = SecretReferenceConfigurationSetting("blah", value="blah") # pylint: disable=no-value-for-parameter


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a duplicate of TestAppConfigurationClientUnitTest underneath this?

Comment on lines +1262 to +1276
class TestAppConfigurationClientAADAsyncUnitTest:
def test_type_error(self):
with pytest.raises(TypeError):
_ = FeatureFlagConfigurationSetting("blah", value="blah")
with pytest.raises(TypeError):
_ = SecretReferenceConfigurationSetting("blah", value="blah") # pylint: disable=no-value-for-parameter


class TestAppConfigurationClientUnitTest:
def test_type_error(self):
with pytest.raises(TypeError):
_ = FeatureFlagConfigurationSetting("blah", value="blah")
with pytest.raises(TypeError):
_ = SecretReferenceConfigurationSetting("blah", value="blah") # pylint: disable=no-value-for-parameter

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, why different aad class?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

App Configuration Azure.ApplicationModel.Configuration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants