Add test recordings for Az.Relationships module#29460
Conversation
Record all 24 test cases for DependencyOf and ServiceGroupMember relationship cmdlets (Get, New, Remove, Update) using Record mode against live Azure services with parent service group SDKTestsSG. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds recorded playback assets to support automated tests for the Az.Relationships module cmdlets.
Changes:
- Added multiple
.Recording.jsonfiles covering CRUD operations for DependencyOf and ServiceGroupMember relationships. - Updated test
env.jsonwith concrete IDs/names used by the recordings. - Updated module
ChangeLog.mdto note the addition of test recordings.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Relationships/Relationships/ChangeLog.md | Documents the addition of test recordings in the upcoming release notes. |
| src/Relationships/Relationships.Autorest/test/env.json | Defines test variables/IDs referenced by the recordings. |
| src/Relationships/Relationships.Autorest/test/Update-AzRelationshipsServiceGroupMemberRelationship.Recording.json | Adds playback recordings for update scenarios (expanded + via identity). |
| src/Relationships/Relationships.Autorest/test/Update-AzRelationshipsDependencyOfRelationship.Recording.json | Adds playback recordings for dependency relationship update scenarios. |
| src/Relationships/Relationships.Autorest/test/Remove-AzRelationshipsServiceGroupMemberRelationship.Recording.json | Adds playback recordings for delete scenarios (expanded + via identity). |
| src/Relationships/Relationships.Autorest/test/Remove-AzRelationshipsDependencyOfRelationship.Recording.json | Adds playback recordings for dependency relationship delete scenarios. |
| src/Relationships/Relationships.Autorest/test/New-AzRelationshipsDependencyOfRelationship.Recording.json | Adds playback recordings for create scenarios (multiple parameter sets + error case). |
| src/Relationships/Relationships.Autorest/test/Get-AzRelationshipsServiceGroupMemberRelationship.Recording.json | Adds playback recordings for get scenarios (by name + via identity). |
| src/Relationships/Relationships.Autorest/test/Get-AzRelationshipsDependencyOfRelationship.Recording.json | Adds playback recordings for get scenarios (by name + via identity). |
| "SgmRelNameForNewSub": "sgmrelsubodg1kq", | ||
| "SgmRelNameToDelete": "sgmreldelodg1kq", | ||
| "SgmRelNameForNewJson": "sgmreljsonodg1kq", | ||
| "SgmTargetId": "/providers/Microsoft.Management/serviceGroups/SDKTestsSG", | ||
| "DepResourceGroupResourceUri": "/subscriptions/453e692a-e16d-441c-bce6-10753115561d/resourceGroups/rg-rel-dep-odg1kq", |
There was a problem hiding this comment.
Hardcoding real subscription/tenant GUIDs and fully-qualified resource URIs in env.json can unintentionally publish environment-specific identifiers and makes playback brittle outside this exact environment. Prefer keeping SubscriptionId / Tenant empty (or using repository-standard variable placeholders) and populating them via CI/test harness at runtime; likewise consider storing only short names (RG name, relationship name) and composing full resource IDs in the test setup.
| "SgmRelNameToDelete": "", | ||
| "SgmRelNameToDeleteViaIdentity": "" | ||
| "SgmRelNameToUpdate": "sgmreluptodg1kq", | ||
| "SubscriptionId": "453e692a-e16d-441c-bce6-10753115561d", |
There was a problem hiding this comment.
Hardcoding real subscription/tenant GUIDs and fully-qualified resource URIs in env.json can unintentionally publish environment-specific identifiers and makes playback brittle outside this exact environment. Prefer keeping SubscriptionId / Tenant empty (or using repository-standard variable placeholders) and populating them via CI/test harness at runtime; likewise consider storing only short names (RG name, relationship name) and composing full resource IDs in the test setup.
| "SubscriptionResourceUri": "/subscriptions/453e692a-e16d-441c-bce6-10753115561d", | ||
| "Tenant": "72f988bf-86f1-41af-91ab-2d7cd011db47", | ||
| "SgmResourceGroupResourceUri": "/subscriptions/453e692a-e16d-441c-bce6-10753115561d/resourceGroups/rg-rel-sgm-odg1kq" |
There was a problem hiding this comment.
Hardcoding real subscription/tenant GUIDs and fully-qualified resource URIs in env.json can unintentionally publish environment-specific identifiers and makes playback brittle outside this exact environment. Prefer keeping SubscriptionId / Tenant empty (or using repository-standard variable placeholders) and populating them via CI/test harness at runtime; likewise consider storing only short names (RG name, relationship name) and composing full resource IDs in the test setup.
| "x-ba-restapi": [ "3.2026.0404.1" ], | ||
| "x-ms-request-id": [ "westus2:5514a57d-4db7-4691-a47f-3cb197541758" ], | ||
| "mise-correlation-id": [ "1b7980da-fe08-42c5-a44f-fe7c6df1c4fd" ], | ||
| "x-ms-operation-identifier": [ "tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47,objectId=2c4638e2-9343-4565-be89-cbdad9762f57/westus2/83d0da14-342f-4ac0-9ecb-7941eff6b9ba" ], |
There was a problem hiding this comment.
The recordings include unsanitized identifiers (tenantId, objectId, subscriptionId, targetTenant, etc.) in headers and payloads. This increases the risk of leaking internal identifiers and can also reduce reusability of recordings across environments. Add/extend test-proxy sanitizers (or the repo’s equivalent recording sanitization rules) to replace these values with deterministic placeholders and re-record so the committed playback assets do not contain real GUIDs.
| "Content-Type": [ "application/json; charset=utf-8" ], | ||
| "Expires": [ "-1" ] | ||
| }, | ||
| "Content": "{\"properties\":{\"targetId\":\"/providers/Microsoft.Management/serviceGroups/SDKTestsSG\",\"sourceId\":\"/subscriptions/453e692a-e16d-441c-bce6-10753115561d/resourceGroups/rg-rel-sgm-odg1kq\",\"targetTenant\":\"72f988bf-86f1-41af-91ab-2d7cd011db47\",\"metadata\":{\"sourceType\":\"Microsoft.Resources/subscriptions/resourceGroups\",\"targetType\":\"Microsoft.Management/serviceGroups\"},\"originInformation\":{\"relationshipOriginType\":\"UserExplicitlyCreated\"},\"provisioningState\":\"Succeeded\"},\"id\":\"/subscriptions/453e692a-e16d-441c-bce6-10753115561d/resourceGroups/rg-rel-sgm-odg1kq/providers/Microsoft.Relationships/serviceGroupMember/sgmreluptodg1kq\",\"name\":\"sgmreluptodg1kq\",\"type\":\"Microsoft.Relationships/serviceGroupMember\"}", |
There was a problem hiding this comment.
The recordings include unsanitized identifiers (tenantId, objectId, subscriptionId, targetTenant, etc.) in headers and payloads. This increases the risk of leaking internal identifiers and can also reduce reusability of recordings across environments. Add/extend test-proxy sanitizers (or the repo’s equivalent recording sanitization rules) to replace these values with deterministic placeholders and re-record so the committed playback assets do not contain real GUIDs.
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Description
Add recorded test cases for all Az.Relationships cmdlets.
24 tests recorded covering DependencyOf and ServiceGroupMember relationship CRUD operations:
Tests use parent service group /providers/Microsoft.Management/serviceGroups/SDKTestsSG for all relationship operations.
Files Changed