Skip to content

[App Config] Sanitize resource group name in data-plane test recordings - #33906

Open
Christine Wanjau (ChristineWanjau) wants to merge 2 commits into
Azure:devfrom
ChristineWanjau:cwanjau/sanitizeResourceGroup
Open

[App Config] Sanitize resource group name in data-plane test recordings#33906
Christine Wanjau (ChristineWanjau) wants to merge 2 commits into
Azure:devfrom
ChristineWanjau:cwanjau/sanitizeResourceGroup

Conversation

@ChristineWanjau

@ChristineWanjau Christine Wanjau (ChristineWanjau) commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

🤖 PR Validation — ️✔️ All clear

Breaking Changes Tests
️✔️ None ️✔️ 130/130

Description

App Configuration data-plane tests use Microsoft Entra ID (--auth-mode login) against stores created with local authentication disabled, which requires the recording principal to hold App Configuration Data Owner on a resource group. Recording against such a group caused the environment-specific resource group name to be baked into the checked-in cassettes.

This change:

  • Adds a recording processor (ResourceGroupNameReplacer) that rewrites the reused live resource group (from the standard AZURE_CLI_TEST_DEV_RESOURCE_GROUP_NAME) to a neutral stub in the recordings, and registers it on the data-plane test classes.
  • Defaults get_test_resource_group() to that same stub during playback so requests match the sanitized cassettes, and fails fast (only in live mode) when no resource group is provided.
  • Sanitizes the resource group name out of the existing data-plane recordings.

Management-plane test recordings are intentionally left untouched.

Testing Guide

Data-plane suite: 20 passed / 3 skipped (live-only). Management suite: 10 passed / 5 skipped. No regressions.

History Notes

[Component Name] az appconfig: Keep environment-specific resource group names out of data-plane test recordings (test-only change).

Register a recording processor that rewrites the reused live resource group (AZURE_CLI_TEST_DEV_RESOURCE_GROUP_NAME) to a neutral stub, and default get_test_resource_group() to that stub during playback, so environment-specific resource group names are kept out of checked-in cassettes.
@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi Christine Wanjau (@ChristineWanjau),
Since the current milestone time is less than 7 days, this pr may not catch up with this release.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@ChristineWanjau
Christine Wanjau (ChristineWanjau) marked this pull request as ready for review August 17, 2026 18:22
Copilot AI lite review requested due to automatic review settings August 17, 2026 18:22
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the az appconfig test infrastructure to prevent environment-specific resource group names from being persisted into App Configuration data-plane test recordings, enabling stable playback across environments.

Changes:

  • Introduces a ResourceGroupNameReplacer recording processor (and registers it on data-plane test classes) to scrub the live dev resource group name into a deterministic stub in recordings.
  • Updates get_test_resource_group() to use AZURE_CLI_TEST_DEV_RESOURCE_GROUP_NAME for live runs, fall back to a sanitized stub in playback, and fail fast in live mode when not configured.
  • Sanitizes existing App Configuration data-plane cassette YAML recordings to replace the previously recorded resource group name with the stub.

Reviewed changes

Copilot reviewed 24 out of 25 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/_test_utils.py Adds sanitized RG stub constant, live/playback RG selection logic, and ResourceGroupNameReplacer processor registration.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/test_appconfig_kv_import_export_commands.py Registers AppConfig-specific recording processors on scenario tests.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/test_appconfig_kv_commands.py Registers AppConfig-specific recording processors on scenario tests; updates one live-run guidance comment.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/test_appconfig_key_validation.py Registers AppConfig-specific recording processors on scenario tests.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/test_appconfig_json_content_type.py Registers AppConfig-specific recording processors on scenario tests.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/test_appconfig_feature_commands.py Registers AppConfig-specific recording processors on scenario tests.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_strict_import.yaml Sanitizes resource group name in recorded ARM interactions.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_snapshot_mgmt.yaml Sanitizes resource group name in recorded ARM interactions.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_snapshot_filtering.yaml Sanitizes resource group name in recorded ARM interactions.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_kv.yaml Sanitizes resource group name in recorded ARM interactions.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_kv_set_snapshot_reference.yaml Sanitizes resource group name in recorded ARM interactions.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_kv_revision_list.yaml Sanitizes resource group name in recorded ARM interactions.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_kv_list_resolve_snapshot_references.yaml Sanitizes resource group name in recorded ARM interactions.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_key_validation.yaml Sanitizes resource group name in recorded ARM interactions.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_json_content_type.yaml Sanitizes resource group name in recorded ARM interactions.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_import_export.yaml Sanitizes resource group name in recorded ARM interactions.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_import_export_respect_both_schemas_naming_conventions.yaml Sanitizes resource group name in recorded ARM interactions.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_import_export_new_fm_schema.yaml Sanitizes resource group name in recorded ARM interactions.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_import_export_naming_conventions.yaml Sanitizes resource group name in recorded ARM interactions.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_import_export_kvset.yaml Sanitizes resource group name in recorded ARM interactions.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_feature.yaml Sanitizes resource group name in recorded ARM interactions.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_feature_telemetry.yaml Sanitizes resource group name in recorded ARM interactions (including telemetry resource IDs).
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_feature_namespacing.yaml Sanitizes resource group name in recorded ARM interactions.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_feature_filter.yaml Sanitizes resource group name in recorded ARM interactions.
src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_appconfig_to_appconfig_import_export.yaml Sanitizes resource group name in recorded ARM interactions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants