Skip to content

Make functional tests workspace-aware and stabilize local debug stack#11975

Draft
sylvainsf wants to merge 3 commits into
mainfrom
sylvainsf/local-functional
Draft

Make functional tests workspace-aware and stabilize local debug stack#11975
sylvainsf wants to merge 3 commits into
mainfrom
sylvainsf/local-functional

Conversation

@sylvainsf
Copy link
Copy Markdown
Contributor

@sylvainsf sylvainsf commented May 21, 2026

Summary

Lets the Radius functional test suites — both corerp-noncloud and
corerp-cloud (Azure) — run against an OS-process Radius debug stack
(make debug-start) on an arbitrary k3d/kind cluster, instead of being
hard-wired to a kind-radius cluster and workspace. Also stabilizes a few
make debug-* targets that didn't reliably bring up their dependencies
on k3d.

Changes

Test infrastructure — workspace-awareness

  • test/functional-portable/corerp/util.go
    • GetSecretSuffix derives the resource group from the active workspace
      (cli.LoadConfigGetWorkspaceParseScope
      FindScope("resourcegroups")) instead of hardcoding kind-radius.
      Falls back to default when nothing is configured.
    • backends.NewKubernetesBackend is constructed from the active workspace
      rather than an assumed context/namespace.
  • test/functional-portable/corerp/noncloud/resources/application_test.go
    • Test_ApplicationGraph PostStepVerify substitutes the fixture's
      kind-radius resource group with the active workspace's resource group
      before unmarshalling.
  • test/functional-portable/corerp/cloud/resources/recipe_terraform_test.go
    • Derives the resource ID from the active workspace scope so it works
      against any RG (CI's kind-radius and local debug's default).
  • test/functional-portable/corerp/cloud/resources/extender_test.go,
    test/rp/rptest.go, test/ucp/ucptest.go, test/validation/shared.go,
    test/functional-portable/cli/noncloud/cli_test.go,
    test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-simulatedenv.bicep
    — incidental cleanups required to run the suites against a
    non-kind-radius workspace; skip AWS-only tests cleanly when AWS env
    vars are unset; skip private-git redis test when GH_TOKEN is unset.

Azure-cloud functional tests against a local OS-process stack

  • build/scripts/azure-local-testenv.sh — new orchestrator with
    setup/run/teardown/all sub-commands. run and all accept
    passthrough go test flags (e.g. -run, -v).
    • Auto-recovery: run rebuilds state from the newest
      radlocal-${USER}-* resource group when the state file is missing
      (e.g. after make debug-stop), and re-applies the Azure scope on the
      default rad environment that debug-start wipes.
    • Orphan GC: teardown --all-orphans deletes every
      radlocal-${USER}-* RG and stops the tf-module-server
      port-forward.
  • pkg/recipes/terraform/config/providers/azure.go — Terraform Azure
    provider falls back to use_cli = true when no Azure credential is
    registered with UCP (404), so the host RP's az login session
    authenticates. CI workload-identity path is unchanged.
  • build/scripts/start-radius.sh — exports
    TERRAFORM_TEST_GLOBAL_DIR so the RP no longer tries to write to a
    read-only /terraform.
  • build/scripts/ensure-encryption-key.sh (new) — generates a stable
    encryption key for the local stack.

make debug-* reliability

  • build/debug.mk
    • debug-install-contour: drop Helm --wait (it doesn't behave for
      LoadBalancer Services on k3d) and instead do explicit
      kubectl wait --for=condition=Available + kubectl rollout status,
      so the target only returns once Contour is actually serving.
    • debug-install-tf-module-server: deploy the in-cluster nginx test
      module server and port-forward it to localhost:8999; add a curl
      readiness probe so subsequent recipe pulls don't race the pod
      becoming Ready.
  • build/test.mk, build/recipes.mk,
    .github/scripts/publish-recipes.sh,
    build/scripts/mirror-test-images.sh (new) — companion glue for
    running the suite locally with mirrored images and locally published
    recipes (the publish script learns PLAIN_HTTP for localhost:5000
    pushes).

Misc

  • pkg/azure/clientv2/unfold.go,
    pkg/corerp/frontend/controller/applications/updatefilter.go,
    pkg/recipes/engine/engine.go — small adjustments surfaced while
    running the suites end-to-end.
  • pkg/corerp/frontend/controller/applications/testbicep_scan_test.go
    (new) — small scan test added during investigation.
  • .gitignore — ignore local debug artifacts and the local-only
    bicepconfig.json override that make debug-publish-bicep-types
    writes.

Documentation

  • docs/contributing/contributing-code/contributing-code-debugging/radius-os-processes-debugging.md
    documents running the Azure cloud suite against the local OS-process
    stack via make debug-start + azure-local-testenv.sh.

How to use locally

make debug-start
make debug-install-contour
make debug-install-tf-module-server

# corerp-noncloud
go test -count=1 -timeout 30m \
  ./test/functional-portable/corerp/noncloud/resources/...

# corerp-cloud (Azure) against the same local stack, using host az login
build/scripts/azure-local-testenv.sh all

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 21, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 71.42857% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.81%. Comparing base (72050b2) to head (8be9a40).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/recipes/engine/engine.go 57.14% 3 Missing ⚠️
pkg/recipes/terraform/config/providers/azure.go 40.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11975      +/-   ##
==========================================
- Coverage   51.83%   51.81%   -0.02%     
==========================================
  Files         728      728              
  Lines       45960    45971      +11     
==========================================
- Hits        23824    23822       -2     
- Misses      19868    19876       +8     
- Partials     2268     2273       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 21, 2026

Unit Tests

    2 files  ±0    429 suites  ±0   7m 28s ⏱️ -1s
5 200 tests +1  5 198 ✅ +1  2 💤 ±0  0 ❌ ±0 
6 278 runs  +1  6 276 ✅ +1  2 💤 ±0  0 ❌ ±0 

Results for commit 8be9a40. ± Comparison against base commit 72050b2.

♻️ This comment has been updated with latest results.

sylvainsf added 3 commits May 20, 2026 21:14
Adds a workflow for running the corerp/cloud Azure functional tests
against a local OS-process Radius stack (`make debug-start`) using the
host's `az login` credentials, with no service-principal/workload-identity
registration required.

Highlights

- New `build/scripts/azure-local-testenv.sh` orchestrator with
  `setup`, `run`, `teardown`, `all` sub-commands. `run` and `all` accept
  passthrough `go test` flags (e.g. `-run`, `-v`).
- Auto-recovery: `run` rebuilds state from the newest
  `radlocal-${USER}-*` resource group when the state file is missing
  (e.g. after `make debug-stop`), and re-applies the Azure scope on the
  default rad environment that `debug-start` wipes.
- Orphan GC: `teardown --all-orphans` deletes every
  `radlocal-${USER}-*` RG and stops the `tf-module-server` port-forward.
- `tf-module-server` bootstrap: deploys the in-cluster nginx test module
  server and port-forwards it to `localhost:8999` automatically when not
  already reachable.
- Terraform Azure provider falls back to `use_cli = true` when no Azure
  credential is registered with UCP (404), letting the host RP's
  `az login` session authenticate. CI workload-identity path is
  unchanged.
- `start-radius.sh` exports `TERRAFORM_TEST_GLOBAL_DIR` so the RP no
  longer tries to write to read-only `/terraform`.
- AWS-required tests skip cleanly via `t.Skip` when AWS env vars are
  unset; private-git redis test skips when `GH_TOKEN` is unset.
- `recipe_terraform_test.go` now derives the resource ID from the
  active workspace scope so it works against any RG (CI's `kind-radius`
  and local debug's `default`).

Tested

Full `corerp/cloud/...` suite green locally:
- PASS: `Test_AzureConnections`, `Test_ACI`, `Test_TerraformRecipe_AzureResourceGroup`
- SKIP: AWS-only tests, `Test_TerraformPrivateGitModule_KubernetesRedis`,
  `Test_Storage`/`Test_PersistentVolume` (issue #7853, pre-existing)

Documentation in
`docs/contributing/contributing-code/contributing-code-debugging/radius-os-processes-debugging.md`.

Signed-off-by: Sylvain Niles <sylvainniles@microsoft.com>
- GetSecretSuffix derives the resource group from the active workspace
  instead of hardcoding kind-radius, so tests pass on local debug stack.
- Test_ApplicationGraph rewrites fixture resource group at runtime to
  match the active workspace.
- debug.mk: install Contour and tf-module-server with explicit rollout
  checks (Helm --wait does not work on k3d for LoadBalancer services).
- Misc test/CLI cleanups for running corerp-noncloud against an
  OS-process Radius stack.
This broke pkg/recipes/driver/bicep Test_Bicep_GetRecipeMetadata_*,
which runs a fake HTTPS registry on 127.0.0.1. With the loopback
heuristic the driver issued http:// requests to an HTTPS server and
got '400 Bad Request' instead of the expected 'not found'.
@sylvainsf sylvainsf force-pushed the sylvainsf/local-functional branch from be17e1e to 8be9a40 Compare May 21, 2026 04:16
@radius-functional-tests
Copy link
Copy Markdown

radius-functional-tests Bot commented May 21, 2026

Radius functional test overview

🔍 Go to test action run

Click here to see the test run details
Name Value
Repository radius-project/radius
Commit ref 8be9a40
Unique ID funcead67aebb7
Image tag pr-funcead67aebb7
  • gotestsum 1.13.0
  • KinD: v0.29.0
  • Dapr: 1.14.4
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-funcead67aebb7
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-funcead67aebb7
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-funcead67aebb7
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-funcead67aebb7
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-funcead67aebb7
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting ucp-cloud functional tests...
⌛ Starting corerp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant