Make functional tests workspace-aware and stabilize local debug stack#11975
Draft
sylvainsf wants to merge 3 commits into
Draft
Make functional tests workspace-aware and stabilize local debug stack#11975sylvainsf wants to merge 3 commits into
sylvainsf wants to merge 3 commits into
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
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'.
be17e1e to
8be9a40
Compare
Radius functional test overviewClick here to see the test run details
Test Status⌛ Building Radius and pushing container images for functional tests... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 beinghard-wired to a
kind-radiuscluster and workspace. Also stabilizes a fewmake debug-*targets that didn't reliably bring up their dependencieson k3d.
Changes
Test infrastructure — workspace-awareness
test/functional-portable/corerp/util.goGetSecretSuffixderives the resource group from the active workspace(
cli.LoadConfig→GetWorkspace→ParseScope→FindScope("resourcegroups")) instead of hardcodingkind-radius.Falls back to
defaultwhen nothing is configured.backends.NewKubernetesBackendis constructed from the active workspacerather than an assumed context/namespace.
test/functional-portable/corerp/noncloud/resources/application_test.goTest_ApplicationGraphPostStepVerify substitutes the fixture'skind-radiusresource group with the active workspace's resource groupbefore unmarshalling.
test/functional-portable/corerp/cloud/resources/recipe_terraform_test.goagainst any RG (CI's
kind-radiusand local debug'sdefault).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-radiusworkspace; skip AWS-only tests cleanly when AWS envvars are unset; skip private-git redis test when
GH_TOKENis unset.Azure-cloud functional tests against a local OS-process stack
build/scripts/azure-local-testenv.sh— new orchestrator withsetup/run/teardown/allsub-commands.runandallacceptpassthrough
go testflags (e.g.-run,-v).runrebuilds state from the newestradlocal-${USER}-*resource group when the state file is missing(e.g. after
make debug-stop), and re-applies the Azure scope on thedefault rad environment that
debug-startwipes.teardown --all-orphansdeletes everyradlocal-${USER}-*RG and stops thetf-module-serverport-forward.
pkg/recipes/terraform/config/providers/azure.go— Terraform Azureprovider falls back to
use_cli = truewhen no Azure credential isregistered with UCP (404), so the host RP's
az loginsessionauthenticates. CI workload-identity path is unchanged.
build/scripts/start-radius.sh— exportsTERRAFORM_TEST_GLOBAL_DIRso the RP no longer tries to write to aread-only
/terraform.build/scripts/ensure-encryption-key.sh(new) — generates a stableencryption key for the local stack.
make debug-*reliabilitybuild/debug.mkdebug-install-contour: drop Helm--wait(it doesn't behave forLoadBalancer 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 testmodule server and port-forward it to
localhost:8999; add acurlreadiness 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 forrunning the suite locally with mirrored images and locally published
recipes (the publish script learns
PLAIN_HTTPforlocalhost:5000pushes).
Misc
pkg/azure/clientv2/unfold.go,pkg/corerp/frontend/controller/applications/updatefilter.go,pkg/recipes/engine/engine.go— small adjustments surfaced whilerunning 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-onlybicepconfig.jsonoverride thatmake debug-publish-bicep-typeswrites.
Documentation
docs/contributing/contributing-code/contributing-code-debugging/radius-os-processes-debugging.mddocuments running the Azure cloud suite against the local OS-process
stack via
make debug-start+azure-local-testenv.sh.How to use locally