Skip to content

Add live E2E deployment test for Aspire.Hosting.Radius - #18730

Merged
Mitch Denny (mitchdenny) merged 13 commits into
microsoft:mainfrom
nellshamrell:radius-deployment-tests
Jul 13, 2026
Merged

Mitch Denny (mitchdenny) merged 13 commits into
microsoft:mainfrom
nellshamrell:radius-deployment-tests

Conversation

@nellshamrell

Copy link
Copy Markdown
Contributor

Description

Follow-up to #18696 (Add Aspire.Hosting.Radius). Adds a live end-to-end deployment test that actually runs aspire deploy (rad deploy app.bicep) against a real AKS cluster with a Radius control plane and verifies the deployed behavior — not just the Bicep snapshot/serializer output covered by the existing unit tests.

Maintainers requested this as a separate second pass after #18696:

it would be valuable to add an E2E deployment test that actually deploys a Radius app and verifies the deployed behavior, rather than relying only on the Bicep snapshot/unit tests. The snapshot tests prove serializer output but not that rad deploy + the generated app.bicep produce a working deployment. This can land as a separate follow-up PR. See the deployment-e2e-testing skill for the expected shape — tests belong under tests/Aspire.Deployment.EndToEnd.Tests/.

What the test does

RadiusStarterDeploymentTests.DeployStarterTemplateToRadiusOnAks:

  1. Provisions a resource group, ACR, and AKS cluster.
  2. Installs the Radius control plane (rad install kubernetes) and creates a deterministic non-interactive workspace scoped to default/default.
  3. Scaffolds the aspire-starter template (with Redis cache).
  4. Builds and pushes the apiservice/webfrontend images to ACR and attaches them via WithContainerImage(...) — required because aspire deploy on Radius only runs rad deploy app.bicep and does not build/push project images.
  5. Runs aspire publish and asserts the generated app.bicep references the pushed ACR images.
  6. Runs aspire deploy, then verifies the deployment: Radius app graph + container resources, all app pods ready (radapp.io/application=app), and the apiservice/webfrontend HTTP endpoints via port-forward.
  7. Cleans up the resource group in a finally.

Notes

  • A gated Setup Radius step is added to deployment-tests.yml (runs only for this test's class) that installs the pinned rad CLI (v0.59.0, matching the integration's Bicep type version).
  • The test is picked up automatically by the existing test-matrix auto-enumeration; no manual matrix/csproj edits are needed.
  • The workflow is gated to the microsoft org, so full live validation happens once this runs against real AKS+Radius infra.

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
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
    • No

Follow-up to microsoft#18696. Adds RadiusStarterDeploymentTests, which deploys the
Aspire starter template to a live Radius environment on AKS and verifies the
deployed app runs (rad resources present, pods ready, HTTP 200) — proving the
`aspire publish` + `rad deploy app.bicep` path works end to end rather than
only validating serializer output via snapshot/unit tests.

- New test builds/pushes the starter images to ACR and attaches them with
  WithContainerImage (the Radius publisher does not push project images yet,
  see microsoft#16844), then asserts app.bicep references the ACR images before deploy.
- Gated "Setup Radius" step in deployment-tests.yml installs the pinned rad
  CLI (0.59.0, aligned with RadiusBicepExtension) only for the Radius matrix
  class.
- README documents the Radius scenario and the rad prerequisite.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 9c52ede6-7b7f-42ee-a961-9e1f19f54315
- Make the app.bicep image-reference check non-vacuous: split the marker
  token in the source command so it appears only in output, not the echoed
  command line (the grep exit code remains the hard gate).
- Add --show-labels to the pod/service listing so a Radius label-schema
  mismatch is visible in the recording rather than surfacing as an empty
  jsonpath during endpoint verification.
- Document that useRedisCache: true is intentional (exercises the Radius
  container recipe + connection wiring).

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 9c52ede6-7b7f-42ee-a961-9e1f19f54315
Copilot AI review requested due to automatic review settings July 10, 2026 20:49
@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 -- 18730

Or

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

@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 Jul 10, 2026

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.

Pull request overview

Adds a live deployment end-to-end test for the new Aspire.Hosting.Radius integration, validating that aspire publish + aspire deploy (via rad deploy app.bicep) results in a working app on a real AKS cluster with a Radius control plane.

Changes:

  • Add a new live AKS+Radius deployment E2E test that provisions infra, publishes, deploys, and verifies endpoints.
  • Add CI workflow gating to install the rad CLI only for the Radius test class.
  • Document the new Radius E2E coverage and prerequisites in the deployment tests README.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
tests/Aspire.Deployment.EndToEnd.Tests/README.md Documents Radius-specific deployment E2E coverage and prerequisites.
tests/Aspire.Deployment.EndToEnd.Tests/RadiusStarterDeploymentTests.cs Adds the new live AKS+Radius deployment E2E test.
.github/workflows/deployment-tests.yml Adds a gated step to install the pinned rad CLI for the Radius test scenario.

Comment thread .github/workflows/deployment-tests.yml Resolved
- Pin the radius install.sh fetch to the v$RADIUS_VERSION release tag instead
  of the moving `main` branch, so the installer script content is locked to the
  same version we install (supply-chain hardening).
- Dispose the TemporaryWorkspace via `using var` so its temp directory is
  cleaned up (matches sibling deployment tests; the workspace is not a CI
  artifact).
- Dispose the resource-group-cleanup Process via `using var` to avoid leaking
  OS handles.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 9c52ede6-7b7f-42ee-a961-9e1f19f54315
Copilot AI review requested due to automatic review settings July 10, 2026 21:05

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

@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.

Validate the Radius.Core UDT application (not just the legacy Redis app) by
using the preview graph implementation and asserting the deployed graph names
both project containers:
- rad app graph -a app --preview (forces the Radius.Core graph; the default
  routes to legacy Applications.Core, which the Redis-only legacy 'app'
  satisfies on its own)
- grep the captured preview graph for apiservice and webfrontend so a missing
  UDT container fails fast

Exercise the Redis-backed output cache by probing /weather instead of / on the
webfrontend. /weather calls the apiservice (WeatherApiClient) and is served
through AddRedisOutputCache; grep for the streamed forecast table so the probe
proves the API + output-cache path end-to-end despite StreamRendering.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 0a2ea3fa-e408-445e-8b72-55eaab7f6661
Copilot AI review requested due to automatic review settings July 10, 2026 22:03

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

The Radius E2E test ran `aspire publish` (which prints "Pipeline succeeded")
and then `aspire deploy` guarded by WaitForPipelineSuccessAsync. That helper
scans the whole terminal viewport for "Pipeline succeeded", so it could match
the stale marker still on screen from the earlier publish and return
immediately -- collapsing the intended 15-minute deploy budget down to the
trailing 2-minute prompt wait.

Wait on the deploy command's sequence-numbered prompt instead (17m, preserving
the prior 15m+2m effective ceiling). That prompt is scoped to this command
alone, so it cannot match the publish marker, and it already fails fast on a
non-zero deploy via the [n ERR:] prompt. The pipeline helper's only extra
behavior is a transient-Azure-capacity Assert.Skip that targets AKS
provisioning; deploy here only runs rad deploy against the already-created
cluster, so that path does not apply.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 0a2ea3fa-e408-445e-8b72-55eaab7f6661
Copilot AI review requested due to automatic review settings July 10, 2026 22:26

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Copilot AI review requested due to automatic review settings July 10, 2026 22:30

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Address round-4 PR review comments on the Radius starter deployment test:

- Isolate kubeconfig: export KUBECONFIG to a throwaway file under the
  TemporaryWorkspace so az/kubectl/rad (incl. aspire-deploy's rad) never
  mutate the developer's ~/.kube/config.
- Isolate rad config: shadow `rad` with a workspace-local PATH shim that
  injects `--config <ws>/.rad/config.yaml` into every invocation (rad has
  no config env var; aspire deploy spawns rad via PATH). The user's
  ~/.rad/config.yaml is never touched, avoiding a backup/restore race.
- Drop `--force` from `rad workspace create`: the isolated config starts
  empty so the name can never collide with a pre-existing workspace.
- Add the ASPIREPIPELINES001 and ASPIRERADIUS057 pragmas independently so
  one already being present never skips adding the other.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 0a2ea3fa-e408-445e-8b72-55eaab7f6661
Copilot AI review requested due to automatic review settings July 10, 2026 23:01

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Address two more round-5 PR review comments on the Radius starter
deployment test:

- Isolate Docker credentials: export DOCKER_CONFIG to a throwaway dir under
  the TemporaryWorkspace in Step 1b so `az acr login` (which shells to
  `docker login`) and `dotnet publish /t:PublishContainer` authenticate
  against isolated creds instead of the developer's ~/.docker/config.json.
- Rewrite the deploy-wait comment to describe the current 17-minute timeout
  constraint directly rather than referencing an earlier PR revision.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 0a2ea3fa-e408-445e-8b72-55eaab7f6661
Copilot AI review requested due to automatic review settings July 10, 2026 23:18
@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.

Add a per-PR KIND-based Radius deploy test (no Azure) that drives the full CLI
path (aspire publish -> aspire deploy -> rad deploy app.bicep) so the Radius
deploy flow gets local coverage on every PR, and get the live AKS Radius
deployment test passing end-to-end:

- Add RadiusDeployTests plus KubernetesDeployTestHelpers/KubernetesE2EVersions
  to install the rad CLI and Radius control plane onto a KIND cluster and verify
  a deployed container serves HTTP.
- Use --no-ssh-key when creating the AKS cluster so the test does not depend on
  the runner having SSH keys.
- Pre-create $HOME/.rad/bin before running the Radius install.sh: the script's
  needsSudo() only checks the install dir's immediate parent, so a fresh runner
  without $HOME/.rad wrongly triggers sudo and leaves the dir root-owned, which
  later breaks the non-sudo "rad bicep download" (config.yaml.lock permission).
- Symlink the default ~/.kube/config to $KUBECONFIG before "rad install
  kubernetes": rad's Contour gateway step reads the default kubeconfig path
  directly and ignores $KUBECONFIG, which the test isolates to the workspace.
- Port-forward to the Deployment instead of a Service in both tests: Radius does
  not synthesize a Kubernetes Service for container workloads (only recipe-backed
  resources such as the Redis cache get one).
- Validate the webfrontend home page instead of the cross-service /weather page:
  webfrontend -> apiservice service discovery does not resolve on Radius (no
  Service for the apiservice container), so /weather cannot render forecast data.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: e6ab6cb7-df30-489d-8140-d00294846005
Copilot AI review requested due to automatic review settings July 12, 2026 11:37

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.

Review details

  • Files reviewed: 6/6 changed files
  • Comments generated: 7
  • Review effort level: Medium

- KIND deploy wait scopes to the deploy command's own sequence-numbered
  success prompt instead of WaitForPipelineSuccessAsync, which could match
  the stale "Pipeline succeeded" left by the earlier `aspire publish`.
- Split the VERIFY_OK success marker in the shell source (VERIFY''_OK) so
  the contiguous token appears only in curl's output, not in the echoed
  command line where WaitUntilTextAsync would match it prematurely.
- AKS test now backs up a real ~/.kube/config and force-symlinks the default
  path to the isolated $KUBECONFIG, then restores it in `finally`, so a local
  run cannot read (or be left pointing at) the developer's own cluster.
- README documents the actual per-container HTTP probes and the current
  Radius limitation (no Service for Radius.Compute/containers workloads), so
  cross-container connectivity is honestly scoped out.
- Corrected the InstallRadiusControlPlaneAsync doc comment: `rad install
  kubernetes` does provision the default group/environment but not a workspace.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: e6ab6cb7-df30-489d-8140-d00294846005

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.

Review details

  • Files reviewed: 6/6 changed files
  • Comments generated: 4
  • Review effort level: Medium

- RestoreDefaultKubeConfig no longer risks deleting a developer's own
  ~/.kube/config: Step 8b now writes a marker before shadowing the path and
  backs up any pre-existing entry (regular file OR symlink, including a dangling
  one, preserved via `cp -a`). Cleanup only runs when the marker is present
  (provisioning can fail before Step 8b) and restores the original verbatim,
  so a local run is never left with a deleted or dangling default kubeconfig.
- Corrected the RadiusDeployTests wiring comment: a native
  Radius.Compute/containers workload gets no Kubernetes Service, so the test
  port-forwards straight to the Deployment (the previous "Service the recipe
  creates" wording was wrong).
- Corrected the class summary: the live Azure/AKS test runs on demand AND
  nightly (deployment-tests.yml schedule), not "only on demand".

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: e6ab6cb7-df30-489d-8140-d00294846005
Copilot AI review requested due to automatic review settings July 12, 2026 22:47

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.

Review details

  • Files reviewed: 6/6 changed files
  • Comments generated: 2
  • Review effort level: Medium

@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.

AKS test (RadiusStarterDeploymentTests): bake a workspace-local HOME
into the Step 1b rad shim so every rad invocation - including
rad workspace create and the rad deploy that aspire deploy spawns -
reads the isolated kubeconfig at $HOME/.kube/config (which several rad
subcommands read directly, ignoring KUBECONFIG). This keeps the
developer's real ~/.kube/config and ~/.rad untouched for the run
without any backup/restore, addressing the shared-state review
feedback. The kubeconfig symlink is folded into Step 1b (its target is
written by az aks get-credentials before the first rad runs).

KIND test (RadiusDeployTests): repin the container image to the stable
digest-pinned mcr.microsoft.com/azuredocs/aci-helloworld to avoid
depending on a mutable tag (tracked by microsoft#18747).

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: e6ab6cb7-df30-489d-8140-d00294846005
Copilot AI review requested due to automatic review settings July 13, 2026 01:32

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.

Review details

  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: Low

@mitchdenny
Mitch Denny (mitchdenny) merged commit 3d63455 into microsoft:main Jul 13, 2026
338 checks passed
@github-actions github-actions Bot added this to the 13.5 milestone Jul 13, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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.

3 participants