Skip to content

Test producer-managed secret connections end to end - #12800

Open
willdavsmith wants to merge 5 commits into
mainfrom
willdavsmith-managed-secret-e2e
Open

Test producer-managed secret connections end to end#12800
willdavsmith wants to merge 5 commits into
mainfrom
willdavsmith-managed-secret-e2e

Conversation

@willdavsmith

@willdavsmith willdavsmith commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • adds focused functional coverage for a Recipe-backed Redis producer that returns ordinary outputs and outputs.secrets
  • verifies Radius materializes the deterministic managed Radius.Security/secrets resource and backing Kubernetes Secret
  • verifies one Container connection emits ordinary CONNECTION_REDIS_HOST/PORT values and secret-backed CONNECTION_REDIS_URL through secretKeyRef for regular and init containers
  • proves the variables are usable at runtime without printing secret values and asserts the Pod spec contains no plaintext secret
  • leaves the existing Container Secret fixture unchanged

Compatibility

The required control-plane support from #12709 and Kubernetes Container Recipe support from radius-project/resource-types-contrib#300 are both merged. The dedicated Recipe Pack selects the published ghcr.io/radius-project/kube-recipes/{containers,rediscaches,secrets}:edge artifacts used by Radius edge/PR functional coverage, so the test exercises the coordinated Radius/contrib contract directly.

The backing Kubernetes Secret is validated by its deterministic resource name because managed Secrets do not carry selector labels matching the managed Radius Secret resource name. Post-step verification also reads the Secret directly and validates its url data key.

Validation

  • gofmt -w test/functional-portable/corerp/noncloud/resources/container_managed_secret_test.go
  • go test ./test/functional-portable/corerp/noncloud/resources -run '^$'
  • go test ./test/validation
  • ~/.rad/bin/bicep format test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-managed-secret.bicep
  • ~/.rad/bin/bicep build test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-managed-secret.bicep --stdout
  • git diff --check
  • fresh non-cloud functional workflow, including corerp-noncloud

@github-actions

Copy link
Copy Markdown

Dependency Review

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

Scanned Files

None

Base automatically changed from willdavsmith-secret-connection-variables to main August 24, 2026 18:07
@willdavsmith
willdavsmith marked this pull request as ready for review August 24, 2026 20:22
@willdavsmith
willdavsmith requested review from a team as code owners August 24, 2026 20:22
Copilot AI lite review requested due to automatic review settings August 24, 2026 20:22

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 an end-to-end functional test that validates “managed secret outputs via connections” for a Recipe-backed Redis producer and a connected Container consumer, ensuring secret values remain secret-backed (Kubernetes secretKeyRef) and are not leaked into producer state or pod specs.

Changes:

  • Added a dedicated Bicep fixture that pins Recipes to resource-types-contrib :edge to exercise managed secret connection behavior.
  • Added a Go functional test that deploys Redis + Container, asserts the deterministic managed Radius.Security/secrets resource + Kubernetes Secret exist, and verifies env var injection uses secretKeyRef (including init containers) without plaintext leakage.

Reviewed changes

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

File Description
test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-container-managed-secret.bicep New fixture wiring Redis producer + Container consumer via a dedicated recipe pack and connection.
test/functional-portable/corerp/noncloud/resources/container_managed_secret_test.go New functional test that validates managed secret resource creation, Kubernetes Secret materialization, and secretKeyRef-based env var projection (no plaintext in pod spec).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown

Unit Tests

    2 files  ±0    461 suites  ±0   8m 29s ⏱️ -8s
6 531 tests ±0  6 529 ✅ ±0  2 💤 ±0  0 ❌ ±0 
7 807 runs  ±0  7 805 ✅ ±0  2 💤 ±0  0 ❌ ±0 

Results for commit 07a666f. ± Comparison against base commit 2062d27.

♻️ This comment has been updated with latest results.

@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.82%. Comparing base (2062d27) to head (07a666f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12800      +/-   ##
==========================================
- Coverage   59.82%   59.82%   -0.01%     
==========================================
  Files         779      779              
  Lines       46058    46058              
==========================================
- Hits        27554    27553       -1     
- Misses      18504    18505       +1     

☔ View full report in Codecov by Harness.
📢 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

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown

Functional Tests - corerp-noncloud

192 tests  +2   188 ✅ +2   59m 49s ⏱️ - 14m 22s
  3 suites ±0     2 💤 ±0 
  1 files   ±0     2 ❌ ±0 

For more details on these failures, see this check.

Results for commit 07a666f. ± Comparison against base commit 2062d27.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown

Functional Tests - statestore-noncloud

2 tests  ±0   2 ✅ ±0   3m 37s ⏱️ +33s
1 suites ±0   0 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit 0628098. ± Comparison against base commit 9ddcccb.

♻️ This comment has been updated with latest results.

@willdavsmith
willdavsmith force-pushed the willdavsmith-managed-secret-e2e branch from 9c43231 to 1f9ec2f Compare August 26, 2026 18:04
@willdavsmith willdavsmith changed the title Test managed secret connections end to end Test producer-managed secret connections end to end Aug 26, 2026
@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown

Functional Tests - corerp-cloud

32 tests  ±0   31 ✅ ±0   21m 18s ⏱️ + 1m 56s
 2 suites ±0    1 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit af15ea7. ± Comparison against base commit 0095696.

♻️ This comment has been updated with latest results.

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

Nice, focused test — the plaintext-leak assertions (producer secrets map has no url, and the pod spec doesn't contain the decoded value) are exactly the right checks, and the namespace/workspace wiring all holds up.

One substantive gap plus a few nits inline.

Missing the delete half of "end to end"

Materializer.Delete is part of the managed-secret contract, but nothing here asserts that the managed Radius.Security/secrets resource and its backing Kubernetes Secret are actually removed when the producer/application is deleted.

Note that listing the managed secret in RPResources does not cover this: validation.DeleteRPResource no-ops for radius.security/secrets (it falls through to the "cleaned up via cascade delete" branch), so the delete path is never directly exercised or verified.

A PostDeleteVerify that asserts both are gone would close the highest-value remaining gap:

PostDeleteVerify: func(ctx context.Context, t *testing.T, test rp.RPTest) {
    _, err := test.Options.ManagementClient.GetResource(ctx, "Radius.Security/secrets", managedSecretName)
    require.Error(t, err, "managed Radius.Security/secrets resource should be deleted with its owner")

    _, err = test.Options.K8sClient.CoreV1().Secrets(name).Get(ctx, managedSecretName, metav1.GetOptions{})
    require.True(t, apierrors.IsNotFound(err), "backing Kubernetes Secret should be deleted with its owner")
},

(PostDeleteVerify is on RPTest, not TestStep, and it's skipped under RADIUS_TEST_FAST_CLEANUP=true — worth confirming the non-cloud workflow doesn't set that, otherwise the assertion silently never runs in CI.)

Signed-off-by: willdavsmith <willdavsmith@gmail.com>
Signed-off-by: willdavsmith <willdavsmith@gmail.com>
Signed-off-by: willdavsmith <willdavsmith@gmail.com>
Signed-off-by: willdavsmith <willdavsmith@gmail.com>
@willdavsmith
willdavsmith force-pushed the willdavsmith-managed-secret-e2e branch from 5a5cb45 to 47a3f94 Compare September 2, 2026 22:33
@radius-functional-tests

radius-functional-tests Bot commented Sep 3, 2026

Copy link
Copy Markdown

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 07a666f
Unique ID funce669b69361
Image tag pr-funce669b69361
  • 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-funce669b69361
  • 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-funce669b69361
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-funce669b69361
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-funce669b69361
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-funce669b69361
  • 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 corerp-cloud functional tests...
⌛ Starting ucp-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.

3 participants