Separate AzureResourceGroup external-dependency tests from unit tests#2044
Open
zentron wants to merge 5 commits into
Open
Separate AzureResourceGroup external-dependency tests from unit tests#2044zentron wants to merge 5 commits into
zentron wants to merge 5 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Stage 2 of the external-test separation, for AzureResourceGroup (stacked on #2040). Splits
Calamari.AzureResourceGroup.Testsinto fast, credential-free unit tests of Calamari's own logic and thinExternalCloudIntegrationsmoke 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)
31a652cCategorise the AzureResourceGroup Bicep deploy test as external cloud — tag the Bicep cloud fixture so CI can run the credential-free suite separately.b3e401dExtract IAzureResourceGroupOperator and unit-test the ARM deploy behaviour — moveArmClientcreation behind a seam; cover Package/Git/Inline source resolution, parameter normalisation and deployment mode/name as credential-free unit tests.c8b89aeExtract 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.1d69d81Drop 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.a29bb86Consolidate AzureResourceGroup cloud test setup and group under ExternalCloudIntegration — hoist the shared auth + resource-group provision/teardown intoAzureResourceGroupCloudTestBaseand move the fixtures into anExternalCloudIntegration/folder.Future work —
Deploy_Ensure_Tools_Are_ConfiguredThis live test verifies the worker's
azCLI / Azure PowerShell by shelling out toaz --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 isExternalTools/AzureCli/inCalamari.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 taggedExternalCloudIntegrationfor now as the interim; flagging so it isn't lost when that project lands.Testing
dotnet test --filter "TestCategory!=ExternalCloudIntegration".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.