Skip to content

Speed up CLI and dashboard tests - #22714

Open
James Newton-King (JamesNK) wants to merge 2 commits into
mainfrom
jamesnk/speed-up-cli-dashboard-tests
Open

James Newton-King (JamesNK) wants to merge 2 commits into
mainfrom
jamesnk/speed-up-cli-dashboard-tests

Conversation

@JamesNK

@JamesNK James Newton-King (JamesNK) commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Description

Reduce CI test time by removing waits and redundant setup in the CLI and dashboard tests without changing production behavior.

  • Simulate NuGet feed failures without HTTP retries while retaining the real local-feed search and credential-redaction assertions.
  • Backdate disk cache entries and verify replacement with two distinct entries instead of sleeping.
  • Keep real Git coverage for configuration sources while removing redundant version checks, passing commit settings inline, and combining revision lookups.
  • Verify that dashboard streams for unknown resources stay pending and honor cancellation instead of waiting for a timeout.
  • Batch the same 10,002 metric data points into two payloads while still crossing the merged attribute-value limit.

Local Windows measurements showed about 44 seconds less combined test duration across the NuGet, disk cache, streaming, and metric cases. The configuration tests launched 699 Git subprocesses instead of 902 (23% fewer). The second Git run was slower overall, including for unchanged commands, so wall-clock savings for that change are not verified. Test parallelism is unchanged.

Validation

  • .\restore.cmd — passed.
  • dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj --no-restore --no-launch-profile -- --filter-method "*.SearchAsync_ReturnsResultsWhenOneSourceFails" --filter-method "*.SearchAsync_RedactsCredentialBearingAmbientSourceDiagnostics" --filter-method "*.SearchAsync_BoundsPaginationAndReportsWhenResultsMayBeIncomplete" --filter-method "*.DiskCacheTests.*" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true" — 10 passed.
  • dotnet test --project tests\Aspire.Dashboard.Tests\Aspire.Dashboard.Tests.csproj --no-restore --no-launch-profile -- --filter-method "*.TelemetryApiServiceTests.Follow*" --filter-method "*.GetInstrument_KnownAttributeValuesIgnoreMergedPerKeyValueLimit" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true" — 9 passed.
  • With GIT_TRACE2_PERF enabled, dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj --no-restore --no-launch-profile -- --filter-method "*.ConfigSourceServiceGitTests.*" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true" --report-trx --results-directory $dir --report-trx-filename git-config-after.trx — 79 passed ($dir was a local scratch directory).

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

@github-actions

Copy link
Copy Markdown
Contributor

🚀 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/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 22714

Or

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

@aspire-repo-bot
aspire-repo-bot Bot requested a balanced review from Copilot November 26, 2026 04:57
@github-actions github-actions Bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Nov 26, 2026
@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block the test-only changes aimed at reducing unnecessary waits and redundant setup.

No open issues 🎉

What changed in this PR

Speeds up Aspire CLI and dashboard tests by removing deliberate waits and redundant setup without changing production code.

Changes:

  • Simulates NuGet failures without HTTP retries, retaining local-feed search and credential-redaction assertions.
  • Backdates cache entries and checks stream cancellation directly instead of waiting for expiry or timeouts.
  • Batches 10,002 metric data points into two payloads while preserving merged attribute-value limit coverage.
File Description
tests/​Aspire.Dashboard.Tests/​TelemetryRepositoryTests/​MetricsTests.cs Batches metric points to reduce repeated instrument validation.
tests/​Aspire.Dashboard.Tests/​TelemetryApiServiceTests.cs Replaces timeout waits with pending-stream and cancellation assertions.
tests/​Aspire.Cli.Tests/​NuGet/​NuGetClientTests.cs Injects immediate search failures and strengthens redacted-log assertions.
tests/​Aspire.Cli.Tests/​Caching/​DiskCacheTests.cs Backdates filenames and verifies distinct entries are consolidated on read.

Review effort: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

2 / 101 PR test projects · 0 PR jobs, from 6 changed files.

Selected PR test projects (2 / 101)

Aspire.Cli.Tests, Aspire.Dashboard.Tests

Selected PR jobs (0)

none


How these were chosen — grouped by what changed

🧪 tests/Aspire.Cli.Tests/Caching/DiskCacheTests.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Configuration/ConfigSourceServiceGitTests.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/NuGet/NuGetClientTests.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Utils/GitTestHelper.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Dashboard.Tests/TelemetryApiServiceTests.cs (changed test)
→ 1 directly: Aspire.Dashboard.Tests

🧪 tests/Aspire.Dashboard.Tests/TelemetryRepositoryTests/MetricsTests.cs (changed test)
→ 1 directly: Aspire.Dashboard.Tests

Job reasons

none


Selection computed for commit 1bfadbb.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the changes reducing CLI and dashboard test overhead.

No open issues 🎉

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants