Skip to content

Harden Phase 7 teardown sequencing for APIM delete/purge races#122

Merged
EMaher merged 5 commits into
mainfrom
copilot/fix-integration-test-deletion-issue
Jun 9, 2026
Merged

Harden Phase 7 teardown sequencing for APIM delete/purge races#122
EMaher merged 5 commits into
mainfrom
copilot/fix-integration-test-deletion-issue

Conversation

Copilot AI commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Teardown could advance before Azure finished deleting APIM-backed resource groups, causing purge to run before the APIM soft-delete record existed. This change tightens teardown ordering so purge is gated on actual deletion state, not timing assumptions.

  • Deletion completion gate

    • Introduces Wait-ForResourceGroupsDeletion and requires both source/target RGs to be fully deleted before proceeding.
    • Replaces the prior short fixed wait behavior with explicit timeout failure instead of continuing on partial state.
  • Soft-delete readiness gate

    • Introduces Wait-ForDeletedApimService to poll deletedservice availability per APIM name + location.
    • Purge now executes only after the soft-deleted service is observable.
  • Operational diagnostics

    • Timeout errors now include actionable context (masked RG/APIM identifiers and location) for faster triage.
Wait-ForResourceGroupsDeletion -ResourceGroups @($SourceResourceGroup, $TargetResourceGroup)

Wait-ForDeletedApimService -ServiceName $sourceApimName -ServiceLocation $Location
az apim deletedservice purge --service-name $sourceApimName --location $Location

@EMaher EMaher marked this pull request as ready for review June 8, 2026 21:54
@EMaher EMaher requested a review from petehauge June 8, 2026 21:54
@EMaher EMaher merged commit 0942ffa into main Jun 9, 2026
5 checks passed
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.

3 participants