Skip to content

Add unit tests for PR #12888 and PR #13065 input behaviors#13079

Merged
JamesNK merged 3 commits intomainfrom
copilot/add-unit-tests-for-changes-again
Dec 9, 2025
Merged

Add unit tests for PR #12888 and PR #13065 input behaviors#13079
JamesNK merged 3 commits intomainfrom
copilot/add-unit-tests-for-changes-again

Conversation

Copy link
Contributor

Copilot AI commented Nov 20, 2025

Plan: Add Unit Tests for PR #12888 and PR #13065 Changes

This task adds unit tests for the changes introduced in PR #12888 and PR #13065, which fixed subscription ID and resource group input behaviors in the Azure provisioning dialog.

Changes in PR #12888:

  • Subscription ID input is now initially disabled when no subscription ID is configured
  • Subscription ID input becomes enabled after tenant selection through dynamic loading
  • Dynamic loading options are only created when subscription ID is not configured

Changes in PR #13065:

  • Subscription InputType is set to Choice when not configured, Text when configured
  • Resource group input no longer has a default value initially
  • Default resource group name is only set during dynamic loading when no existing resource groups are found
  • Location field checks if resource group has a location before disabling

Testing Plan:

  • Understand PR Fix subscription ID not being disabled on Azure provisioning dialog #12888 changes
  • Add test: Subscription ID input starts disabled when not configured
  • Add test: Subscription ID input has dynamic loading that depends on tenant selection
  • Add test: Subscription ID input becomes enabled after tenant selection
  • Add test: Subscription ID input has no dynamic loading when pre-configured
  • Understand PR Fixes to Azure provisioning dialog #13065 changes
  • Add assertion: Subscription InputType is Choice when not configured
  • Add assertion: Resource Group has no default value initially
  • Add test: Resource Group default value behavior
  • Rebase on latest main (commit 7a69234)
  • Build and run tests to verify (all 16 tests pass)
  • Review and commit

Tests Added:

PR #12888 Tests:

  1. CreateProvisioningContextAsync_SubscriptionInputStartsDisabledWhenNotConfigured - Verifies subscription input starts disabled with dynamic loading, InputType is Choice, and Resource Group has no default value
  2. CreateProvisioningContextAsync_SubscriptionInputDependsOnTenantWhenNotConfigured - Verifies subscription input dynamic loading depends on tenant
  3. CreateProvisioningContextAsync_SubscriptionInputBecomesEnabledAfterTenantSelection - Verifies subscription input becomes enabled after tenant selection
  4. CreateProvisioningContextAsync_SubscriptionInputHasNoDynamicLoadingWhenConfigured - Verifies no dynamic loading when subscription is pre-configured, InputType is Text

PR #13065 Tests:
5. CreateProvisioningContextAsync_ResourceGroupHasNoDefaultValueInitially - Verifies Resource Group has no default value initially and only gets default when no existing groups are found

All 16 tests in ProvisioningContextProviderTests pass successfully after rebasing on latest main commit 7a69234.

Original prompt

Add unit tests for the changes in #12888


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add unit tests for changes in pull request 12888 Add unit tests for subscription ID input behavior from PR #12888 Nov 20, 2025
Copilot AI requested a review from JamesNK November 20, 2025 23:14
@JamesNK
Copy link
Member

JamesNK commented Nov 21, 2025

@copilot Add asserts for LocationName input that check DynamicLoading.DependsOnInputs value.

Copy link
Contributor Author

Copilot AI commented Nov 21, 2025

@copilot Add asserts for LocationName input that check DynamicLoading.DependsOnInputs value.

Added assertions to verify LocationName input's DependsOnInputs contains both SubscriptionIdName and ResourceGroupName in commit 3bfcbe3.

@JamesNK JamesNK force-pushed the copilot/add-unit-tests-for-changes-again branch from 3bfcbe3 to 76f4f04 Compare November 21, 2025 01:08
@github-actions
Copy link
Contributor

github-actions bot commented Nov 21, 2025

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 13079

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 13079"

@JamesNK JamesNK marked this pull request as ready for review November 21, 2025 01:09
Copilot AI review requested due to automatic review settings November 21, 2025 01:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive unit test coverage for the subscription ID input behavior introduced in PR #12888, which fixed the subscription input to be disabled until tenant selection. The tests validate the complete state machine of the subscription input across different configuration scenarios.

Key Changes

  • Four new test methods validate subscription input initialization, dependencies, state transitions, and pre-configured behavior
  • Tests cover both dynamic loading scenarios (when subscription ID is not configured) and static scenarios (when pre-configured)
  • All tests follow existing patterns in the file and correctly validate the behavior

Copilot AI and others added 2 commits November 21, 2025 13:05
Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>
@JamesNK JamesNK force-pushed the copilot/add-unit-tests-for-changes-again branch from 76f4f04 to 8caecd1 Compare November 21, 2025 05:05
@JamesNK
Copy link
Member

JamesNK commented Nov 21, 2025

@copilot Also unit test changes in #13065

- Add assertion for InputType.Choice when subscription ID is not configured
- Add assertion for Resource Group having no default value initially
- Add test for Resource Group default value behavior during dynamic loading

Co-authored-by: JamesNK <303201+JamesNK@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 21, 2025

@copilot Also unit test changes in #13065

Added unit tests for PR #13065 changes in commit c2dab36:

  • Subscription InputType.Choice when not configured (vs Text when configured)
  • Resource Group has no default value initially
  • Resource Group default value behavior during dynamic loading

Copilot AI changed the title Add unit tests for subscription ID input behavior from PR #12888 Add unit tests for PR #12888 and PR #13065 input behaviors Nov 21, 2025
@JamesNK JamesNK added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Nov 21, 2025
@JamesNK
Copy link
Member

JamesNK commented Dec 8, 2025

@copilot Rebase on latest main commit

Copy link
Contributor Author

Copilot AI commented Dec 8, 2025

@copilot Rebase on latest main commit

Successfully rebased on latest main (commit 7a69234). The branch now has the latest changes from main and all 16 tests pass. However, I cannot force push due to system constraints. The rebase is complete locally at commit 2c8374b87 (was c2dab36 before rebase). You may need to manually force push or I can create a small change to trigger a regular push.

@JamesNK JamesNK merged commit 07793e3 into main Dec 9, 2025
300 of 302 checks passed
@JamesNK JamesNK deleted the copilot/add-unit-tests-for-changes-again branch December 9, 2025 11:15
@dotnet-policy-service dotnet-policy-service bot added this to the 13.1 milestone Dec 9, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Jan 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants