Repository navigation
test(e2e): check storage UIDs across SDK destroy and expired-token refusal - #13161
Closed
cuongdangn wants to merge 3 commits into
Closed
cuongdangn wants to merge 3 commits into
cuongdangn wants to merge 3 commits into
Conversation
…fusal SDK destroy must keep the namespace, the KEK Secret and the gateway's PersistentVolumeClaim with unchanged UIDs, and the gateway installed from the pinned chart must refuse an expired development token signed by the deployment's own key. The checks run in the existing kind live tests. Refs #12731 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Resolve the conflict in docs/contributing/live-tests.md: keep v1's data.fabric_agent_readiness.assistant and this branch's destroy sentence. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Collaborator
|
Continued as #13421, which keeps your commit and authorship, rebased onto current |
cv
added a commit
that referenced
this pull request
Oct 18, 2026
…fusal (#13421) Part of #12731. Recreates #13161 by @cuongdangn on a fresh branch, because that branch doesn't allow maintainer edits. The commit keeps their authorship. ## Failure The live Kind tests would pass two regressions: - **SDK destroy:** the tests that deploy through the public SDK only checked that no destroy change named `kubernetes_storage`. They never read the cluster after `Deployment::destroy`, so they'd pass a destroy that recreated the namespace or key, deleted the gateway's claim, or left the gateway installed. - **Expired tokens:** the gateway test only checked that a token signed by an unknown key is refused. A gateway that stopped checking `exp` would still pass. ## Decision The same checks as #13161, adapted to current `v1`: - **Expired token:** after each install, the gateway test signs an expired development token with the deployment's own key and requires the gateway to refuse it. It also requires a current token from the same key to be accepted, so a refusal can only come from expiry. - **SDK destroy:** destroy must remove the gateway's Helm release record and StatefulSet. It must keep the namespace, the encryption key Secret and the gateway's PersistentVolumeClaim with unchanged UIDs. - **Rebased onto `v1`:** #13161 added a separate plain-Kubernetes deployment test for the destroy checks. Since #13379, apply completes through `fabric-agent-ctl`, and the registry test (`kubernetes_registry.rs`) already deploys an agent on Kubernetes through `deploy_image_and_export`. So the destroy checks run inside `deploy_image_and_export`, covering both the registry test and the OpenShift test, without adding another slow live test. Production code is unchanged. ## Validation - `cargo ci` passes locally: 1,589 unit tests and 153 lifecycle tests. - `cargo ci live-kind` passes locally: all 7 tests, including the new checks. Co-authored-by: Leo Dang <[email protected]>
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.
Adds scenario 12 from the recovery scenarios in #12731 to the kind live tests. SDK destroy must keep the namespace, the KEK Secret and the gateway's PersistentVolumeClaim with unchanged UIDs. The gateway installed from the pinned chart must refuse an expired development token signed by the deployment's own key. Production code is unchanged;
docs/contributing/live-tests.mddescribes the new checks.Failure
Before this change, the live tests would pass two regressions:
deploy_to_the_health_check, which both public-SDK tests run, only checked that no destroy change nameskubernetes_storage. It never read the cluster afterDeployment::destroy. Its tests would pass a destroy that:The raw OpenTofu test compares these identities, but across its own teardown graph, not across
Deployment::destroy.The gateway test only checked that a token signed by an unknown key is refused. A gateway that stopped checking
expwould still pass it.Decision
Expired token.
authenticated_gatewayruns in the raw OpenTofu test after each of its two installs.<state>/kubernetes/auth, where the OpenShell provider keeps it.signing.pk8, becauseDevelopment::ensurecreates new material in an empty directory.GetGatewayInfofail with exactlyAuthentication. The gateway at OpenShelle1f3c82validates bearer tokens with jsonwebtoken's default 60-second leeway and returnsUnauthenticatedfor any decode error.Permissionwould mean authentication had passed.The public-SDK tests are not used for this, for two reasons. Presenting a token needs a gateway connection, which needs a generation that
Deploymentdoes not expose. That connection would also hold the loopback port that export and destroy bind.Storage identities.
deploy_to_the_health_checkrecords three things:It records them after export, which only refreshes, and again right after destroy. It compares them after the existing cleanup. Before comparing, it asserts that destroy removed the gateway's Helm release record and StatefulSet, so the comparison spans a real removal. The Kubernetes and OpenShift profiles both run it.
retained().Result, so a failed observation before destroy no longer skips cleanup.app.kubernetes.io/instance=<release>. The sandbox's workspace claim shares the namespace, and destroy deletes it asynchronously.No SDK re-apply after destroy. The raw test already re-applies after removal. A second SDK apply would repeat the gateway install and sandbox creation in the agent test, which already takes 67.4 to 88.5 s of its 120 s budget on recent v1 pushes.
These are characterization tests: they check behavior that already exists, so there is no failing test to observe first. No mutation probe was run. The checks need the real gateway and a cluster, and
cargo ci live-kindruns only on Linux.Validation
cargo cion macOS arm64 at24bdaa10f8(this change merged with v133c3f11ccb) passed in 531 s. Its planner selected bundle and lifecycle, so every step ran: fmt, clippy, build, test (1485 passed), schema, bundle, and lifecycle (137 passed). It compiles and lints the live tests but does not run them.cargo run --locked -p nemoclaw-build -- fern checkalso passed, on Node 22.23.2 rather than the documented 24.21.0.cargo ci live-kindruns only on Linux. This pull request's Live / Kind jobs ran them on the merge commitb9c564f362(24bdaa10f8into v14fe7431785). All five passed on both architectures, within budget:an_agent_sandbox_reaches_its_health_check_and_destroy_keeps_storageon_openshift_the_sandbox_runs_as_the_namespace_uidthe_gateway_installs_authenticates_and_is_removed_keeping_storagekubernetes_charttestsJobs: linux_arm64, linux_amd64. On the six v1 pushes from
e0c8f19d4ato4fe7431785whose Live / Kind jobs ran, the three live tests took 67.4 to 88.5 s, 63.0 to 79.1 s and 26.4 to 34.8 s respectively, and the wall time was 160.9 to 200.6 s; the times above fall within those ranges.Recorded inputs, as #12730 asks for live evidence:
24bdaa10f8(15956c22efmerged with v133c3f11ccb); localcargo cion24bdaa10f8; Live / Kind on merge commitb9c564f362(v14fe7431785)bundle-linux_arm64-b9c564f362ef…-1andbundle-linux_amd64-b9c564f362ef…-1, kept one daye1f3c82caa3e(v0.1.3): gatewaysha256:ea14aa4db098…, supervisorsha256:4ab2b970cdb0…, sandboxsha256:2658534bfb3f…, chartsha256:44ec11bbf264…nginx-unprivileged@sha256:5aea7cc516b4…24f068c895e5kindest/node:v1.37.0@sha256:a1ed56cfb0e7…, one node with kind's default CNI and StorageClass; Agent Sandbox v0.5.0 (manifestsha256:ccfe3649de8b…)sha256:e33f7076522e…), OpenClaw on linux_amd64 (sha256:85bc11cac5d0…)ubuntu-24.04-armimage20261004.142.1andubuntu-24.04image20261012.334.1Limits of this evidence
data.fabric_agent_readiness.assistant(Apply always fails at Fabric readiness; the pinned Fabric has no health API and is not on main #13031). No inference is requested.e1f3c82. OpenShell's v0.1.3 release run built the pinned gateway image and chart from that commit. The jsonwebtoken version in the gateway binary is inferred from that commit'sCargo.lock, not read from the image.Refs #12731
🤖 Generated with Claude Code