Repository navigation
test(terraform): add plan-level tests for 032-fabric-rti and 072-azure-local-host - #874
Open
Shivam Sharma (ShivamSharma43) wants to merge 4 commits into
Conversation
…e-local-host Part of microsoft#152. - 032-fabric-rti: minimal EventStream, CI-style DAG with custom endpoint, default stream and Eventhouse/Lakehouse destinations, operators with a derived stream, and the custom template override. - 072-azure-local-host: default cluster, custom cluster settings, admin groups with Azure RBAC disabled, the aad_profile validation, and additional node pools. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Shivam Sharma <192242476+ShivamSharma43@users.noreply.github.com>
Shivam Sharma (ShivamSharma43)
requested review from
a team
and
a balanced review from Copilot
October 11, 2026 15:26
5 of 21 tasks
Katrien De Graeve (katriendg)
approved these changes
Oct 13, 2026
Katrien De Graeve (katriendg)
left a comment
Collaborator
There was a problem hiding this comment.
This looks good, thanks for your contribution.
Katrien De Graeve (katriendg)
added a commit
that referenced
this pull request
Oct 13, 2026
…#875) Adds plan-level Terraform tests for the last two untested components listed in #152: `080-azureml` and `140-azureml`. Each component gets a `tests/base.tftest.hcl` and a `tests/setup` module, following the pattern from #821 and #874. All runs use `command = plan` with `mock_provider`, so no Azure credentials are needed. ## Related Issue Relates to #152 With #821, #861 and #874, this covers the remaining components in that issue. It doesn't touch any component code. ## Type of Change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Blueprint modification or addition - [ ] Component modification or addition - [ ] Documentation update - [ ] CI/CD pipeline change - [x] Other (please describe): tests only, no changes to component code ## Implementation Details `080-azureml` (mocks `azapi` and `azurerm`; `azurerm_client_config` is overridden): - `create_default_configuration`: the workspace name (`mlw-...`), location and resource group, the compute subnet name (`subnet-<prefix>-azureml-...`) and the compute cluster name (`cluster-...`). No registry, private endpoint, DNS zones, AKS integration or workload identity by default. - `create_with_custom_names_and_existing_subnet`: provided workspace and cluster names are used. With `should_create_compute_cluster_snet = false` and `compute_cluster_subnet`, no subnet is created but the cluster still is. - `create_without_compute_cluster`: neither the cluster nor its subnet is created, and the cluster outputs are null. - `create_with_private_endpoint`: the workspace private endpoint name (`pe-mlw-...`) and the two private DNS zones (`privatelink.api.azureml.ms`, `privatelink.notebooks.azure.net`). - `integrate_aks_cluster`: the extension name, and the compute target name with hyphens removed and truncated to 16 characters (`environment = "staging-west"`). - `reject_invalid_inputs` / `reject_invalid_resource_prefix`: the single-variable validations (`compute_cluster_max_nodes`, `compute_cluster_vm_priority`, `inference_router_service_type`, `aks_cluster_purpose`, `resource_prefix`). `140-azureml` (mocks `azapi`, `azurerm` and `tls`): - `create_default_configuration`: extension name (`azureml-...`) and compute target name (`arck-...`), the target's workspace, location, `Kubernetes` compute type and connected cluster ID, the default description, local auth disabled, `azureml` namespace, the component's default instance type (`8Gi` memory limit), `Stable` release train, and a system-assigned identity. - `create_with_custom_compute_settings`: provided names, description, local auth, namespace, default instance type, release train and virtual cluster name are passed through. Provided instance types replace the default, and `cluster_integration_workspace_identity_id` switches the target to a user-assigned identity. - `configure_extension_with_tls_tolerations_and_workload_identity`: runs the `inference-cluster-integration` module directly, because the extension settings and federated credentials are not exposed as component outputs. Checks the string-typed feature flags, `relayserver.enabled = "true"`, `allowInsecureConnections = "false"` with the protected TLS settings when CNAME, certificate and key are all set, the indexed `toleration[n]` / `workLoadToleration[n]` keys (unset fields left out), and one federated identity credential per subject, with the name derived from the subject, the cluster OIDC issuer and the workload identity. - `reject_invalid_inference_router_service_type`: the variable validation. Some outputs (`kubernetes_compute`, `azureml_extension`) wrap whole resources in `try()`, so a single unknown computed attribute makes them unknown at plan. The tests override only the computed attributes they depend on (the extension `id` and identity principal, and the compute `id`) with `override_during = plan`. The 080 tests don't cover the cross-variable validations (`nat_gateway`, `network_security_group`, `ml_workload_identity`, min/max nodes) because #862 moves them. I also ran these 080 tests against the #862 head, and all 8 runs pass there too. ## Testing Performed - [ ] Terraform plan/apply - [ ] Blueprint deployment test - [ ] Unit tests - [ ] Integration tests - [ ] Bug fix includes regression test (see [Test Policy](docs/contributing/testing-validation.md)) - [ ] Manual validation - [x] Other: `terraform test` (plan-level, mock providers) Run with no `ARM_*` or `AZURE_*` variables set: - `terraform init -backend=false` and `terraform test` in each component, with Terraform 1.16.5 and 1.15.0: `080-azureml` 8 passed, 0 failed; `140-azureml` 5 passed, 0 failed. - `terraform validate` in each component: valid. - `terraform fmt -check -recursive` on both `tests/` directories: no changes. - `tflint --disable-rule=terraform_required_providers --recursive` with the repo `.tflint.hcl`: no findings. I also checked that the tests fail when the component is wrong. I broke a copy of each component, one change at a time, and every one of these 10 changes made at least one run fail: - the subnet label - the cluster name prefix - a DNS zone name - the 16-character truncation - creating the subnet without a cluster - `relayserver.enabled` - the TLS check - the default instance type memory - the `workLoadToleration` key - the user-assigned identity block ## Additional Notes While writing the registry case for 080 I found that `should_deploy_registry = true` currently fails at plan with azapi 2.13.0: ``` embedded schema validation failed: the argument "body" is invalid: `properties.description` is not expected here. ``` The root module always passes a `description` (`coalesce(var.registry_description, ...)`), and the `Microsoft.MachineLearningServices/registries@2025-07-01-preview` schema has no `properties.description`, so the registry can't be planned with schema validation on. I left the registry out of these tests. I'm happy to open a separate issue or fix for it if you'd like. ## Validation Steps 1. `cd src/000-cloud/080-azureml/terraform && terraform init -backend=false && terraform test` 2. `cd src/100-edge/140-azureml/terraform && terraform init -backend=false && terraform test` No Azure login is needed for either. ## Checklist - [ ] I have updated the documentation accordingly - [x] I have added tests to cover my changes - [ ] All new and existing tests passed - [x] I have run `terraform fmt` on all Terraform code - [x] I have run `terraform validate` on all Terraform code - [ ] I have run `az bicep format` on all Bicep code 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Shivam Sharma <192242476+ShivamSharma43@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Katrien De Graeve <katriendg@users.noreply.github.com>
This branch has not been deployed
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.
Pull Request
Description
Adds plan-level Terraform tests for two more of the untested components listed in #152:
032-fabric-rtiand072-azure-local-host. Each component gets atests/base.tftest.hcland atests/setupmodule, following the pattern from #821. All runs usecommand = planwithmock_provider, so no Azure credentials are needed.Related Issue
Relates to #152
This covers 2 more of the 11 components in that issue, so it does not close it. It doesn't touch the components in #821 or the open #861 and #862.
Type of Change
Implementation Details
032-fabric-rti(mocksazurermandfabric). The assertions decode the generatedeventstream.jsonContenttoken and check the DAG it describes:create_minimal_eventstream: with only a workspace, the EventStream uses thees-<prefix>-<env>-<instance>name and the bundled template. The definition has no sources, destinations, streams or operators, retention defaults to 7 days and throughput toMedium. No source connection is looked up.create_eventstream_with_destinations: the CI-style DAG (one custom endpoint, a default stream, an Eventhouse and a Lakehouse destination). Checks theuuidv5node IDs, the default stream name (<eventstream>-stream), the{ name = ... }input-node shape, Eventhouse before Lakehouse ordering, and the defaults for EventhousetableNameanddataIngestionModeand Lakehouseschema. Also checks the provided retention and throughput, and that one source connection is looked up per custom endpoint with the generated source ID.create_eventstream_with_operators: a filter and a union operator feeding a derived stream. Checks that the default stream comes before derived streams, the documented operator order, and the filter'sexpressionTypedefault.create_eventstream_with_custom_template:eventstream_template_file_pathandtemplate_tokensreplace the generated template andContenttoken.072-azure-local-host(mocksazapi,azurermandtls;azurerm_client_configis overridden so the tenant and subscription are fixed):create_default_configuration: the connected cluster name (arck-...), parent resource group,ProvisionedClusterkind, Azure RBAC on with no admin groups, and tenant from the current client. Also checks the logical network lookup's name and subscription-scoped parent, and the provisioned cluster's custom location. Covers the node-pool, control-plane, pod CIDR and CSI driver defaults, and that no extra agent pools are planned.create_with_custom_cluster_settings: the SSH key, control plane IP/count/size, node pool count/size, Kubernetes version, pod CIDR, load balancer count, CSI drivers and Azure Hybrid Benefit are passed through.create_with_admin_groups: withenable_azure_rbac = false, the admin group IDs and the provided tenant ID are used.reject_disabled_rbac_without_admin_groups: disabling Azure RBAC without admin groups fails theaad_profilevalidation.create_additional_nodepools: one agent pool peradditional_nodepoolsentry, with theLinux/CBLMarinerdefaults and overrides, and the custom location.Neither component has
ci/terraform/*.tfvars, so the required inputs come from the setup module, as in the other component tests.Testing Performed
terraform test(plan-level, mock providers)Run with no
ARM_*orAZURE_*variables set:terraform init -backend=falseandterraform testin each component, with Terraform 1.16.5 and 1.15.0:032-fabric-rti5 passed, 0 failed;072-azure-local-host6 passed, 0 failed.terraform validatein each component: valid.terraform fmt -check -recursiveon bothtests/directories: no changes.tflint --disable-rule=terraform_required_providers --recursivewith the repo.tflint.hcl: no findings.I also checked that the tests fail when the component is wrong. I broke a copy of each: dropping the Eventhouse
tableNamedefault, changing the default stream ID, swapping stream order, sending admin groups even with RBAC on, ignoring the provided tenant ID, and hard-coding the agent pool OS SKU. Each change made at least one run fail.Validation Steps
cd src/000-cloud/032-fabric-rti/terraform && terraform init -backend=false && terraform testcd src/000-cloud/072-azure-local-host/terraform && terraform init -backend=false && terraform testNo Azure login is needed for either.
Checklist
terraform fmton all Terraform codeterraform validateon all Terraform codeaz bicep formaton all Bicep codeaz bicep buildto validate all Bicep codeSecurity Review
Additional Notes
The new tests pass on their own. I did not run the existing tests in other components, since most of them need an Azure subscription. The SSH key in
create_with_custom_cluster_settingsis a placeholder string, not a real key.🤖 Generated with Claude Code