Skip to content

Separate AzureResourceGroup external-dependency tests from unit tests#2044

Open
zentron wants to merge 5 commits into
robe/azure-external-test-categorizationfrom
rone/azure-external-test-categorization-stg2
Open

Separate AzureResourceGroup external-dependency tests from unit tests#2044
zentron wants to merge 5 commits into
robe/azure-external-test-categorizationfrom
rone/azure-external-test-categorization-stg2

Conversation

@zentron

@zentron zentron commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

What this does

Stage 2 of the external-test separation, for AzureResourceGroup (stacked on #2040). Splits Calamari.AzureResourceGroup.Tests into fast, credential-free unit tests of Calamari's own logic and thin ExternalCloudIntegration smoke tests that hit real Azure. The Azure calls each deploy behaviour makes are pulled behind seams (IAzureResourceGroupOperator, IBicepTemplateBuilder) so the template-source / parameter / deployment-mode routing is unit-tested with mocks; the live fixtures shrink to one Package smoke deploy each.

Best reviewed commit-by-commit — each compiles and is self-contained.

Commits (in order)

  • 31a652c Categorise the AzureResourceGroup Bicep deploy test as external cloud — tag the Bicep cloud fixture so CI can run the credential-free suite separately.
  • b3e401d Extract IAzureResourceGroupOperator and unit-test the ARM deploy behaviour — move ArmClient creation behind a seam; cover Package/Git/Inline source resolution, parameter normalisation and deployment mode/name as credential-free unit tests.
  • c8b89ae Extract IBicepTemplateBuilder and unit-test the Bicep deploy behaviour — move the az-cli compile and resource-group create behind seams; unit-test source resolution and wiring without Azure or the az cli.
  • 1d69d81 Drop redundant Git and Inline cloud deploy tests — Package/Git/Inline routing is now unit-tested, so the live Git and Inline deploys duplicated the Package smoke.
  • a29bb86 Consolidate AzureResourceGroup cloud test setup and group under ExternalCloudIntegration — hoist the shared auth + resource-group provision/teardown into AzureResourceGroupCloudTestBase and move the fixtures into an ExternalCloudIntegration/ folder.

Future work — Deploy_Ensure_Tools_Are_Configured

This live test verifies the worker's az CLI / Azure PowerShell by shelling out to az --version / Get-AzureEnvironment / az group list. It is the flakiest of the cloud tests because it depends on whatever az happens to be installed on the agent and still runs a real resource-group deploy. It is really an Azure CLI tool test, not an SDK cloud-integration test — its eventual home is ExternalTools/AzureCli/ in Calamari.ExternalTools.Tests (per the External Tool Test Separation plan), running against a manifest-pinned az version rather than the agent's ambient one. Left in place and tagged ExternalCloudIntegration for now as the interim; flagging so it isn't lost when that project lands.

Testing

  • Credential-free unit suite passes locally: dotnet test --filter "TestCategory!=ExternalCloudIntegration".
  • The ARM Package smoke (Deploy_with_template_in_package) ran for real against Azure and passed. The two [WindowsTest] cloud tests (Deploy_Ensure_Tools_Are_Configured, DeployAzureBicepTemplate_PackageSource) skip on non-Windows and want a Windows CI run to confirm.

⚠️ No Server change required — Calamari-internal test/infra refactor, no contract change.

zentron and others added 5 commits June 26, 2026 11:15
DeployAzureBicepTemplateCommandFixture provisions a real resource group, so
tag it ExternalCloudIntegration like AzureResourceGroupActionHandlerFixture.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…viour

Move ArmClient creation behind IAzureResourceGroupOperator and read templates
via ITemplateService so DeployAzureResourceGroupBehaviour's template-source,
parameter, deployment-mode and name logic is covered by credential-free unit
tests instead of live-Azure deploys.
Move the az-cli bicep compile behind IBicepTemplateBuilder and the resource-group
create+deploy behind IAzureResourceGroupOperator.DeployCreatingResourceGroup, so
DeployBicepTemplateBehaviour's source resolution and wiring is unit-tested without
Azure or the az cli.
Package/Git/Inline template-source routing is now unit-tested in the deploy
behaviour fixtures, so the live Git and Inline deploys duplicated the Package
smoke test. Keep one Package deploy per fixture (plus the ARM tooling check).
…nalCloudIntegration

Hoist the duplicated service-principal auth and resource-group provision/teardown
from the two cloud fixtures into a shared AzureResourceGroupCloudTestBase, and move
the fixtures into an ExternalCloudIntegration/ folder so the credential-free vs
live-Azure split is visible in the tree.
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.

1 participant