Skip to content

Conversation

Copy link
Contributor

Copilot AI commented May 20, 2025

This PR adds test coverage for the --aspire-version template option to ensure it works correctly across different framework targets.

Changes

Added tests in NewUpAndBuildSupportProjectTemplatesTests.cs for:

  • --aspire-version 9.2
  • --aspire-version 9.3

These test cases will run across all SDK and target framework combinations through the existing test infrastructure, ensuring comprehensive coverage of this option.

Motivation

With .NET 9.1 adding support for selecting between versions 8.2, 9.0, and 9.1 (depending on the target framework), we needed test coverage for this potentially fragile area of the codebase.

The added test cases validate that the template parameter works correctly in all supported environments.

Fixes #7279.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • azuresearch-usnc.nuget.org
    • Triggering command: /home/REDACTED/work/aspire/aspire/artifacts/bin/dotnet-tests/dotnet new aspire-starter -o aspire-starter_net9.0_h5q3ofcj_n3q -f net9.0 --debug:custom-hive /tmp/templates-$6d9d664d/templates (dns block)
    • Triggering command: /home/REDACTED/work/aspire/aspire/artifacts/bin/dotnet-tests/dotnet new aspire-starter --use-redis-cache -o aspire-starter_net8.0_m0lf40se_wsj -f net8.0 --debug:custom-hive /tmp/templates-$6d9d664d/templates (dns block)
  • azuresearch-ussc.nuget.org
    • Triggering command: /home/REDACTED/work/aspire/aspire/artifacts/bin/dotnet-tests/dotnet new aspire-starter -o aspire-starter_net9.0_h5q3ofcj_n3q -f net9.0 --debug:custom-hive /tmp/templates-$6d9d664d/templates (dns block)
  • dnceng.pkgs.visualstudio.com
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet build tests/Aspire.Templates.Tests/Aspire.Templates.Tests.csproj (dns block)
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet test tests/Aspire.Templates.Tests/Aspire.Templates.Tests.csproj --filter FullyQualifiedName~NewUpAndBuildSupportProjectTemplates.CanNewAndBuild --logger console;verbosity=detailed (dns block)
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet build tests/workloads.proj (dns block)
  • pkgs.dev.azure.com
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet build tests/Aspire.Templates.Tests/Aspire.Templates.Tests.csproj (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)
    • Triggering command: /home/REDACTED/work/aspire/aspire/.dotnet/dotnet test tests/Aspire.Templates.Tests/Aspire.Templates.Tests.csproj --filter FullyQualifiedName~NewUpAndBuildSupportProjectTemplates.CanNewAndBuild --logger console;verbosity=detailed (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: danmoseley <6385855+danmoseley@users.noreply.github.com>
Copilot AI changed the title [WIP] Add test coverage for --aspire-version template option Add test coverage for --aspire-version template option May 20, 2025
Copilot AI requested a review from danmoseley May 20, 2025 22:20
@radical radical marked this pull request as ready for review May 21, 2025 00:49
Copilot AI review requested due to automatic review settings May 21, 2025 00:49
@radical radical requested review from eerhardt and radical as code owners May 21, 2025 00:49
Copy link
Member

@radical radical left a comment

Choose a reason for hiding this comment

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

LGTM!

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 automated tests to verify the newly supported --aspire-version template option works correctly for versions 9.2 and 9.3 across all SDK and TFM combinations.

  • Introduces two new MemberData entries to cover --aspire-version 9.2 and --aspire-version 9.3.
  • Ensures the existing test infrastructure runs these cases alongside other template tests.
Comments suppressed due to low confidence (1)

tests/Aspire.Templates.Tests/NewUpAndBuildSupportProjectTemplatesTests.cs:19

  • Consider adding negative or unsupported version tests (e.g., --aspire-version 10.0 or invalid strings) to validate proper error handling, and expand coverage to other templates (like aspire-starter or aspire-webapi) that also accept the --aspire-version option.
[MemberData(nameof(TestDataForNewAndBuildTemplateTests), arguments: ["aspire-xunit", "--aspire-version 9.2"])]

@radical
Copy link
Member

radical commented May 21, 2025

@danmoseley this looks ready. Do we want to make any other changes here before merging?

@danmoseley danmoseley merged commit ca9fc4d into main May 21, 2025
500 of 503 checks passed
@danmoseley danmoseley deleted the copilot/fix-7279 branch May 21, 2025 02:42
@danmoseley
Copy link
Member

incidentally @radical it does seem to be mostly building OK now
#9433

but not able to run the template tests specifically due to firewall. hopefully it's only those that need network access

  [dotnet-new]     Resource temporarily unavailable
  [dotnet-new]   Retrying 'FindPackagesByIdAsync' for source 'https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/a54510f9-4b2c-4e69-b96a-6096683aaa1f/nuget/v3/flat2/microsoft.extensions.logging.abstractions/index.json'.

@DamianEdwards
Copy link
Member

Just curious, this PR only has a small change that only seems to test the aspire-xunit template. Does this change result in testing the version option for all the templates?

@danmoseley
Copy link
Member

Indeed. @radical what is the state of our template coverage overall nowadays? I see this

    // [MemberData(nameof(TestDataForNewAndBuildTemplateTests), arguments: "aspire-apphost")]
    // [MemberData(nameof(TestDataForNewAndBuildTemplateTests), arguments: "aspire-servicedefaults")]

commented

@github-actions github-actions bot locked and limited conversation to collaborators Jun 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add test coverage for --aspire-version template option

4 participants