一键导入
testing-aso-recordings
Use when you need to run ASO controller CRUD tests or sample tests, verify recordings play back correctly, or re-record after changes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when you need to run ASO controller CRUD tests or sample tests, verify recordings play back correctly, or re-record after changes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | testing-aso-recordings |
| description | Use when you need to run ASO controller CRUD tests or sample tests, verify recordings play back correctly, or re-record after changes. |
ASO uses go-vcr to record and replay HTTP interactions with Azure. Tests run in two modes:
The test framework automatically chooses: if a recording file exists, it replays; if not, it records live. Both test suites use envtest (a local Kubernetes API server) to run the controller under test.
| Controllers | Samples | |
|---|---|---|
| Task command | controller:test-controllers | controller:test-samples |
| Log file | reports/test-controllers.log | reports/test-samples.log |
| Test source | v2/internal/controllers/ | v2/internal/testsamples/samples_test.go |
| Suite setup | v2/internal/controllers/suite_test.go | v2/internal/testsamples/suite_test.go |
| Recordings dir | v2/internal/controllers/recordings/ | v2/internal/testsamples/recordings/Test_Samples_CreationAndDeletion/ |
| Playback (full suite) | 6–10 min | 5–10 min |
| Playback (single test) | 1–3 min | 2–3 min |
When to run which suite:
v2/samples/, grouped by resource group.Controller tests follow the pattern <group>_<subject>_<scenario>_<version>_test.go (e.g. crd_networking_virtualnetwork_v1api20201101_test.go). Each file contains hand-written Go test functions.
Sample tests are generated dynamically — samples_test.go walks v2/samples/ and creates a subtest per version directory. Test names follow the pattern Test_<TitleCasedSubgroup>_<version>_CreationAndDeletion. Example: v2/samples/documentdb/mongodb/v1api20231115/ → Test_Mongodb_v1api20231115_CreationAndDeletion. (Only the last directory segment before the version is used.)
Before running tests:
AZURE_SUBSCRIPTION_ID and AZURE_TENANT_ID are set (or that the user has provided a test.env file to source). These are required for recording (live Azure calls). ENTRA_APP_ID may also be needed depending on the test — check whether the test references it before requiring it. If required variables are missing and recordings need to be created, do not proceed — tell the user what is missing and stop. Playback runs do not need them.Run all tests as a background terminal command:
source test.env && task controller:<SUITE>
Replace <SUITE> with test-controllers or test-samples. For playback-only runs (all recordings exist), omit source test.env.
Do NOT add | tee or other output redirection — the taskfile already pipes output to the log file.
For recording runs of slow resources, override the default Go test timeout:
source test.env && TIMEOUT=60m TEST_FILTER="<test>" task controller:test-controllers
Run the command in async mode. Monitor progress using sleep + tail on the log file (see Monitoring below).
Add TEST_FILTER to run a subset:
Controllers:
TEST_FILTER="<your-test-here>" task controller:test-controllers
Samples:
TEST_FILTER="Test_Samples_CreationAndDeletion/<your-test-here>" ./hack/tools/task controller:test-samples
After the test command finishes, confirm no failures in the log:
grep "FAIL:" reports/<LOG-FILE> || echo "No failures found"
Replace <LOG-FILE> with the appropriate log file from the Test Suites table.
sleep <seconds> && tail -3 reports/<LOG-FILE> to check progress at intervals. DO NOT poll in a tight loop — use 300-second (5 min) sleeps between checks. Key log markers to watch for:
"MonitorDelete" — test in cleanup"PASS" / "FAIL" — test completed"saving ARM client recorder" — recording was written to disktask directly — never use ./hack/tools/task. If task is not on the PATH, your environment is not set up correctly for testing. Stop and ask the user to fix your environment.When finished, provide a table to the user showing the tests that have been run, their results, and any recordings that were created or updated.
Use when creating polished ASO release notes by automatically determining changes from git history since the last release tag.
Use when creating a new ASO release, including pre-checks, release notes generation, draft GitHub release creation, documentation updates, and ROADMAP changes.
Use when ASO controller CRUD tests or sample tests fail during playback or recording, to diagnose the failure and re-record if needed.
**WORKFLOW SKILL** — Migrate an Azure resource group from legacy to hybrid versioning mode in ASO. USE FOR: moving a group (e.g., appconfiguration, cache, network) from VersionMigrationModeLegacy to VersionMigrationModeHybrid in the code generator, updating samples, renaming CRUD tests, and re-recording sample tests. DO NOT USE FOR: adding new resources (use new-resource.instructions.md), general debugging, or code review.