Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Param(
[switch]$CleanUp,

[Parameter()]
[string]$ResourceGroupName = "cli-local-test-rg",
[string]$ResourceGroupName = "cli-testing-rg",

[Parameter()]
[switch]$Live
Expand All @@ -20,10 +20,6 @@ Param(
# Set rg for local testing
$env:AZURE_CLI_TEST_DEV_RESOURCE_GROUP_NAME=$ResourceGroupName

# Unique prefix for resources
$prefix=(Get-Date).ToString("yyyyMMddHHmm")
$env:AZURE_CLI_LOCAL_TEST_RESOURCE_PREFIX=$prefix

# Run tests
if ($Live) {
Write-Host "Running all tests live"
Expand All @@ -36,36 +32,33 @@ else {

function clean_up_resources {
param (
[string]$rgName,
[string]$prefix
[string]$rgName
)

# List all resources in the Resource Group
$resources = az resource list --resource-group $rgName --query "[].{name: name, id: id}" | ConvertFrom-Json

if ($resources -eq "") {
if ($null -eq $resources -or $resources.Count -eq 0) {
Write-Host "No resources found in resource group $rgName."
return
}

# Delete resources that start with the given prefix
# Delete all resources in the test resource group
foreach ($resource in $resources) {
if ($resource.name.StartsWith($prefix)) {
Write-Host "Deleting resource: $($resource.name)"

try {
# Delete the resource using its ID
az resource delete --ids $resource.id
Write-Host "Successfully deleted resource: $($resource.name)"
} catch {
Write-Host "Failed to delete resource: $($resource). Error: $_"
}
Write-Host "Deleting resource: $($resource.name)"

try {
Comment on lines +46 to +50
# Delete the resource using its ID
az resource delete --ids $resource.id
Write-Host "Successfully deleted resource: $($resource.name)"
} catch {
Write-Host "Failed to delete resource: $($resource). Error: $_"
}
}
}

# Clean up
if ($CleanUp) {
Write-Host "Cleaning up resources"
clean_up_resources -rgName $ResourceGroupName $prefix
clean_up_resources -rgName $ResourceGroupName
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ def create_config_store(test, kwargs, disable_local_auth=False):
test.cmd(command)


def _get_local_test_resource_prefix():
return os.environ.get("AZURE_CLI_LOCAL_TEST_RESOURCE_PREFIX")

def get_resource_name_prefix(prefix):
resource_prefix = _get_local_test_resource_prefix()
return prefix if resource_prefix is None else resource_prefix + prefix

# Value the reused live test resource group (AZURE_CLI_TEST_DEV_RESOURCE_GROUP_NAME) is rewritten to
# in recordings by ResourceGroupNameReplacer. Matches the default ResourceGroupPreparer() moniker.
SANITIZED_TEST_RESOURCE_GROUP = "clitest.rg000001"
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14558,7 +14558,7 @@ interactions:
x-ms-date:
- May, 20 2026 08:28:30.575242 GMT
method: GET
uri: https://disablelocalauthkvcfn5qv.azconfig.io/kv/test?api-version=2023-11-01
uri: https://disablelocalauthkvcfn5qv.azconfig.io/kv/test?api-version=2026-05-01-preview
response:
body:
string: ''
Expand Down Expand Up @@ -14605,7 +14605,7 @@ interactions:
x-ms-date:
- May, 20 2026 08:28:31.975768 GMT
method: PUT
uri: https://disablelocalauthkvcfn5qv.azconfig.io/kv/test?api-version=2023-11-01
uri: https://disablelocalauthkvcfn5qv.azconfig.io/kv/test?api-version=2026-05-01-preview
response:
body:
string: '{"etag":"o6T7_Q9Ew_JQo3r4LUF7hO_eWrtXL-CVDlQTe47COyg","key":"test","label":null,"content_type":"","value":"","tags":{},"locked":false,"last_modified":"2026-05-20T08:28:32+00:00"}'
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from unittest import mock
from azure.cli.testsdk import (ResourceGroupPreparer, live_only, ScenarioTest)
from azure.cli.testsdk.scenario_tests import AllowLargeResponse
from azure.cli.command_modules.appconfig.tests.latest._test_utils import create_config_store, CredentialResponseSanitizer, get_resource_name_prefix, register_appconfig_query_matcher
from azure.cli.command_modules.appconfig.tests.latest._test_utils import create_config_store, CredentialResponseSanitizer, register_appconfig_query_matcher
from azure.cli.command_modules.appconfig._constants import FeatureFlagConstants, KeyVaultConstants

TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..'))
Expand Down Expand Up @@ -107,7 +107,7 @@ def __init__(self, *args, **kwargs):
@AllowLargeResponse()
@ResourceGroupPreparer(parameter_name_for_location='location')
def test_azconfig_aad_auth(self, resource_group, location):
aad_store_prefix = get_resource_name_prefix('AADStore')
aad_store_prefix = 'AADStore'
config_store_name = self.create_random_name(prefix=aad_store_prefix, length=24)

location = 'eastus'
Expand Down Expand Up @@ -310,7 +310,7 @@ def test_azconfig_credential_adaptor_token_override(self, get_subscription_mock,
@AllowLargeResponse()
@ResourceGroupPreparer(parameter_name_for_location='location')
def test_azconfig_user_token_audience(self, resource_group, location):
aad_store_prefix = get_resource_name_prefix('AADStore')
aad_store_prefix = 'AADStore'
config_store_name = self.create_random_name(prefix=aad_store_prefix, length=24)

location = 'eastus'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from azure.cli.testsdk import (ResourceGroupPreparer, ScenarioTest)
from azure.cli.testsdk.scenario_tests import AllowLargeResponse
from azure.cli.command_modules.appconfig.tests.latest._test_utils import create_config_store, CredentialResponseSanitizer, get_resource_name_prefix, register_appconfig_query_matcher
from azure.cli.command_modules.appconfig.tests.latest._test_utils import create_config_store, CredentialResponseSanitizer, register_appconfig_query_matcher

class AppConfigCredentialScenarioTest(ScenarioTest):

Expand All @@ -19,7 +19,7 @@ def __init__(self, *args, **kwargs):
@AllowLargeResponse()
@ResourceGroupPreparer(parameter_name_for_location='location')
def test_azconfig_credential(self, resource_group, location):
credential_store_prefix = get_resource_name_prefix('CredentialTest')
credential_store_prefix = 'CredentialTest'
config_store_name = self.create_random_name(prefix=credential_store_prefix, length=24)

location = 'eastus'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from azure.cli.command_modules.appconfig._constants import FeatureFlagConstants
from azure.cli.core.azclierror import InvalidArgumentValueError
from azure.cli.testsdk.scenario_tests import AllowLargeResponse
from azure.cli.command_modules.appconfig.tests.latest._test_utils import AppConfigResourceGroupPreparer, create_config_store, CredentialResponseSanitizer, get_resource_name_prefix, register_appconfig_query_matcher, register_appconfig_recording_processors
from azure.cli.command_modules.appconfig.tests.latest._test_utils import AppConfigResourceGroupPreparer, create_config_store, CredentialResponseSanitizer, register_appconfig_query_matcher, register_appconfig_recording_processors

TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..'))

Expand All @@ -29,7 +29,7 @@ def __init__(self, *args, **kwargs):
# Uses Entra ID auth (store created with local auth disabled). For live recording, set
# AZURE_CLI_TEST_DEV_RESOURCE_GROUP_NAME to a group where you hold "App Configuration Data Owner".
def test_azconfig_feature(self, resource_group, location):
feature_test_store_prefix = get_resource_name_prefix('featuretest')
feature_test_store_prefix = 'featuretest'
config_store_name = self.create_random_name(prefix=feature_test_store_prefix, length=24)

location = 'eastus'
Expand Down Expand Up @@ -472,7 +472,7 @@ def test_azconfig_feature(self, resource_group, location):
# Uses Entra ID auth (store created with local auth disabled). For live recording, set
# AZURE_CLI_TEST_DEV_RESOURCE_GROUP_NAME to a group where you hold "App Configuration Data Owner".
def test_azconfig_feature_namespacing(self, resource_group, location):
feature_namespace_store_prefix = get_resource_name_prefix('featurenamespacetest')
feature_namespace_store_prefix = 'featurenamespacetest'
config_store_name = self.create_random_name(prefix=feature_namespace_store_prefix, length=24)

location = 'eastus'
Expand Down Expand Up @@ -576,7 +576,7 @@ def test_azconfig_feature_namespacing(self, resource_group, location):
# AZURE_CLI_TEST_DEV_RESOURCE_GROUP_NAME to a group where you hold "App Configuration Data Owner".
def test_azconfig_feature_telemetry(self, resource_group, location):
"""Test feature flag telemetry functionality."""
feature_telemetry_store_prefix = get_resource_name_prefix('featuretelemetrytest')
feature_telemetry_store_prefix = 'featuretelemetrytest'
config_store_name = self.create_random_name(prefix=feature_telemetry_store_prefix, length=24)

location = 'eastus'
Expand Down Expand Up @@ -637,7 +637,7 @@ def test_azconfig_feature_telemetry(self, resource_group, location):
# Link App Insights to the store
# Use a fake resource ID because the application-insights extension cannot be installed
# in recording/playback mode — the extension index response exceeds the VCR 1024KB limit.
app_insights_prefix = get_resource_name_prefix('appinsights')
app_insights_prefix = 'appinsights'
app_insights_name = self.create_random_name(prefix=app_insights_prefix, length=24)
app_insights_id = '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/{}/providers/microsoft.insights/components/{}'.format(self.kwargs['rg'], app_insights_name)
self.kwargs.update({
Expand Down Expand Up @@ -670,7 +670,7 @@ def __init__(self, *args, **kwargs):
# Uses Entra ID auth (store created with local auth disabled). For live recording, set
# AZURE_CLI_TEST_DEV_RESOURCE_GROUP_NAME to a group where you hold "App Configuration Data Owner".
def test_azconfig_feature_filter(self, resource_group, location):
feature_filter_store_prefix = get_resource_name_prefix('featurefiltertest')
feature_filter_store_prefix = 'featurefiltertest'
config_store_name = self.create_random_name(prefix=feature_filter_store_prefix, length=24)

location = 'eastus'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# pylint: disable=line-too-long

from azure.cli.testsdk import (ResourceGroupPreparer, ScenarioTest)
from azure.cli.command_modules.appconfig.tests.latest._test_utils import create_config_store, CredentialResponseSanitizer, get_resource_name_prefix, register_appconfig_query_matcher
from azure.cli.command_modules.appconfig.tests.latest._test_utils import create_config_store, CredentialResponseSanitizer, register_appconfig_query_matcher

class AppConfigIdentityScenarioTest(ScenarioTest):

Expand All @@ -17,7 +17,7 @@ def __init__(self, *args, **kwargs):

@ResourceGroupPreparer(parameter_name_for_location='location')
def test_azconfig_identity(self, resource_group, location):
config_store_prefix = get_resource_name_prefix('IdentityTest')
config_store_prefix = 'IdentityTest'
config_store_name = self.create_random_name(prefix=config_store_prefix, length=24)

location = 'eastus'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from knack.util import CLIError
from azure.cli.testsdk import ScenarioTest
from azure.cli.testsdk.scenario_tests import AllowLargeResponse
from azure.cli.command_modules.appconfig.tests.latest._test_utils import AppConfigResourceGroupPreparer, create_config_store, CredentialResponseSanitizer, get_resource_name_prefix, register_appconfig_query_matcher, register_appconfig_recording_processors
from azure.cli.command_modules.appconfig.tests.latest._test_utils import AppConfigResourceGroupPreparer, create_config_store, CredentialResponseSanitizer, register_appconfig_query_matcher, register_appconfig_recording_processors
from azure.cli.command_modules.appconfig._constants import AIConfigConstants, FeatureFlagConstants, KeyVaultConstants

TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..'))
Expand All @@ -32,8 +32,8 @@ def __init__(self, *args, **kwargs):
# Uses Entra ID auth (store created with local auth disabled). For live recording, set
# AZURE_CLI_TEST_DEV_RESOURCE_GROUP_NAME to a group where you hold "App Configuration Data Owner".
def test_azconfig_json_content_type(self, resource_group, location):
src_config_store_prefix = get_resource_name_prefix('source')
dest_config_store_prefix = get_resource_name_prefix('destination')
src_config_store_prefix = 'source'
dest_config_store_prefix = 'destination'
src_config_store_name = self.create_random_name(prefix=src_config_store_prefix, length=24)
dest_config_store_name = self.create_random_name(prefix=dest_config_store_prefix, length=24)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from knack.util import CLIError
from azure.cli.testsdk import ScenarioTest
from azure.cli.testsdk.scenario_tests import AllowLargeResponse
from azure.cli.command_modules.appconfig.tests.latest._test_utils import AppConfigResourceGroupPreparer, create_config_store, CredentialResponseSanitizer, get_resource_name_prefix, register_appconfig_query_matcher, register_appconfig_recording_processors
from azure.cli.command_modules.appconfig.tests.latest._test_utils import AppConfigResourceGroupPreparer, create_config_store, CredentialResponseSanitizer, register_appconfig_query_matcher, register_appconfig_recording_processors

TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..'))

Expand All @@ -28,7 +28,7 @@ def __init__(self, *args, **kwargs):
# Uses Entra ID auth (store created with local auth disabled). For live recording, set
# AZURE_CLI_TEST_DEV_RESOURCE_GROUP_NAME to a group where you hold "App Configuration Data Owner".
def test_azconfig_key_validation(self, resource_group, location):
config_store_prefix = get_resource_name_prefix('kvtest')
config_store_prefix = 'kvtest'
config_store_name = self.create_random_name(prefix=config_store_prefix, length=24)

location = 'eastus'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from azure.cli.command_modules.appconfig._constants import KeyVaultConstants
from azure.cli.core.azclierror import RequiredArgumentMissingError, InvalidArgumentValueError, MutuallyExclusiveArgumentError
from azure.cli.testsdk.scenario_tests import AllowLargeResponse
from azure.cli.command_modules.appconfig.tests.latest._test_utils import AppConfigResourceGroupPreparer, create_config_store, CredentialResponseSanitizer, get_resource_name_prefix, register_appconfig_query_matcher, register_appconfig_recording_processors
from azure.cli.command_modules.appconfig.tests.latest._test_utils import AppConfigResourceGroupPreparer, create_config_store, CredentialResponseSanitizer, register_appconfig_query_matcher, register_appconfig_recording_processors

TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..'))

Expand All @@ -32,7 +32,7 @@ def __init__(self, *args, **kwargs):
def test_azconfig_kv(self, resource_group, location):
# Lowercase store-name prefix so the HTTP-lowercased '<name>.azconfig.io' host matches the
# name registered with the recording name-replacer, keeping cassettes scrubbed for playback.
config_store_prefix = get_resource_name_prefix('kvtest')
config_store_prefix = 'kvtest'
config_store_name = self.create_random_name(prefix=config_store_prefix, length=24)

location = 'eastus'
Expand Down Expand Up @@ -317,7 +317,7 @@ def test_azconfig_kv(self, resource_group, location):
@KeyVaultPreparer(additional_params="--enable-rbac-authorization false")
@live_only()
def test_resolve_keyvault(self, key_vault, resource_group):
config_store_prefix = get_resource_name_prefix('kvtest')
config_store_prefix = 'kvtest'
config_store_name = self.create_random_name(prefix=config_store_prefix, length=24)

location = 'eastus'
Expand Down Expand Up @@ -377,7 +377,7 @@ def test_azconfig_kv_revision_list(self, resource_group, location):
# and HTTP lowercases the host, so a mixed-case name would not match the (case-sensitive)
# name registered with the recording name-replacer, leaving the live host unscrubbed in the
# cassette and breaking playback. A lowercase name keeps recording and playback hosts aligned.
config_store_prefix = get_resource_name_prefix('kvrevisiontest')
config_store_prefix = 'kvrevisiontest'
config_store_name = self.create_random_name(prefix=config_store_prefix, length=24)

location = 'eastus'
Expand Down
Loading
Loading