Repository navigation
test(e2e): read and remove remote service networks less often - #12982
Merged
Merged
Conversation
The bearer lifecycle test drove three credential-volume faults (missing, another owner's label, replaced under the same name) through CLI plan and apply against the SSH simulator: six runtime refreshes, each of which waits 2 s on the service network read. The provider owns that classification, so check all three faults for both storage kinds through pinned OpenTofu against a fake engine: plan and apply fail with the observation reason and leave the state and volume unchanged.
Each runtime plan, apply, export, or destroy after a remote service's Docker network exists reads it, and the pinned Docker provider waits 2 s before each read and after each removal. The remote_service tests made 75 such reads, about 150 s of their 404 s. Run each check against one runtime per scenario, once: - vLLM failed-creation and lost-process recovery run only in the bearer scenario, so the unauthenticated vLLM recovery test is removed. - The two Ollama tests become one, without the runtime-independent readiness, compute replacement, and pull policy checks that run against vLLM. - The bearer damage checks run after replacement cleanup instead of in a deployment of their own, with one credential-volume fault; the provider's storage contract test covers all three. - Pi applies once instead of repeating failed-creation recovery, and skips an export after a refusal that left the intent unchanged. The tests now make 48 network reads.
Contributor
cv
added a commit
that referenced
this pull request
Oct 11, 2026
## Failure Lifecycle tests are split into partitions with nextest's `hash:` mode. With 129 tests, the hash puts 74 of them in partition 1 and 55 in partition 2 on Linux and macOS. On Windows the three partitions get 35, 41, and 39 tests. Each partition keeps its four test slots busy, so its wall time is about its summed test time divided by four, and the slowest partition sets the step's wall time. Execute step times on recent v1 runs, in seconds: | Run | linux_arm64 | linux_amd64 | darwin_arm64 | windows_amd64 | |---|---|---|---|---| | [#12981](https://github.com/NVIDIA/NemoClaw/actions/runs/38130235163) | 208 / 158 | 203 / 157 | 187 / 145 | 105 / 176 / 152 | | [#12982](https://github.com/NVIDIA/NemoClaw/actions/runs/38129638172) | 208 / 158 | 233 / 173 | 215 / 139 | 84 / 145 / 156 | | [#12974](https://github.com/NVIDIA/NemoClaw/actions/runs/38098264065) | 207 / 186 | 231 / 184 | 183 / 175 | 113 / 169 / 227 | ## Decision Use `--partition slice:m/n`. Nextest sorts the selected tests by binary and name and deals them round-robin. The slow scenarios are `nemoclaw-e2e` `deployment::` and `remote_service::` tests, and they sort next to each other, so dealing them alternately splits them evenly. Each partition now gets 64 or 65 tests on Linux. I replayed the per-test times from two v1 runs' JUnit reports through a four-slot scheduler that follows nextest's order. For the hash partitions, it reproduces the measured partition times to within about 1 s. For linux_arm64, I checked the slice membership against `cargo nextest list --partition slice:m/2` on that run's CI archive. Predicted nextest wall time, in seconds: | Platform | Hash, slowest partition | Slice, per partition | Ideal (sum / slots) | |---|---|---|---| | linux_arm64 | 201 | 177 / 174 | 174 | | linux_amd64 | 193–222 | 170 / 170 – 193 / 193 | 169–191 | | darwin_arm64 | 178–205 | 160 / 150 – 172 / 165 | 152–163 | | windows_amd64 | 142–164 | 128 / 141 / 147 – 127 / 135 / 120 | 105–120 | Alternatives considered: - Test priorities that start the `remote_service::` and `deployment::` scenarios first would only help Windows, by about 15 s on top of slices. They would also tie the nextest config to module names, so I left them out. - A third Linux or macOS partition would bring each one to about 120–135 s. It would also add a runner and about 20 s of job setup and extraction per partition. On Linux, lifecycle is not on the critical path: Live / Docker and Live / Kind start at the same time and run for 490–750 s. - Two Windows partitions would take about 170–187 s, which is slower than three hash partitions are today. Trade-off: with slice partitions, membership depends on the selected test list. Adding or removing a lifecycle test moves later tests to other partitions. For a given revision and platform, partitions stay fixed. Part of #12882. ## Validation - Locally: `cargo fmt --all --check` and `cargo clippy --workspace --all-targets -- -D warnings`. The change is to CI configuration and docs, with no Rust behavior to test; `crates/nemoclaw-build/tests/ci_lifecycle.rs` already covers passing `--partition` through. - `cargo nextest list --profile lifecycle --run-ignored only --partition hash:m/2` on run 38130235163's linux_arm64 archive lists 74 / 55 tests, matching CI. `slice:m/2` lists 65 / 64. - [CI on this PR](https://github.com/NVIDIA/NemoClaw/actions/runs/38133026550): every lifecycle partition passed. Execute step times in seconds, with nextest wall time and summed test time from the JUnit reports: | Platform | Before, slowest step (3 v1 runs) | After, steps | After, nextest wall | After, summed test time | |---|---|---|---|---| | linux_arm64 | 207–208 | 184 / 184 | 175 / 175 | 695 / 694 | | linux_amd64 | 203–233 | 202 / 207 | 190 / 196 | 757 / 777 | | darwin_arm64 | 183–215 | 159 / 145 | 151 / 137 | 578 / 542 | | windows_amd64 | 156–227 | 143 / 131 / 152 | 132 / 118 / 142 | 441 / 425 / 499 | This run's linux_amd64 tests summed to 1,534 s. That is close to the 1,528 s of the #12982 run, whose slowest hash partition took 233 s; the slice partitions finished within 6 s of each other.
kaofelix
added a commit
that referenced
this pull request
Oct 29, 2026
…and contract tests (#13874) ## Failure `managed_bearer_cleanup_recovers_damage_keeps_bindings_and_teardown_accepts_both_identities` took 40-43 s locally and 54-92 s on `linux_amd64` CI. The lifecycle limit is 90 s per test. The scenario runs 14 `nemoclaw` commands of about 3 s each. About 2 s of each command is the pinned `kreuzwerker/docker` provider waiting before every `docker_network` read (#12982). ## Decision Replace the scenario with faster tests. Every NemoClaw behavior it checked still has a test that fails when the behavior breaks, and the affected lifecycle tests drop from about 74 s to about 37 s summed in local runs. Each check that only this scenario made moves to the fastest test that can still make it. Most of these checks concern replacement cleanup. When OpenTofu replaces a container but fails to delete the old one, it keeps the old container in state as a *deposed* object, and the next apply deletes it. | Check | New home | Cost | |---|---|---| | The SDK lets apply delete a deposed container, accepts one that is already gone, and lets destroy delete both containers. Export refuses while a deposed container remains. | New SDK test `replacement_cleanup`. It runs `Deployment` over the scripted OpenTofu. | 1.4 s, in the unit and integration step | | Pinned OpenTofu and the Docker provider 4.6.0 report a deposed container in the shapes the SDK test uses. | New `nemoclaw-provider` contract test `replacement_cleanup`. It runs OpenTofu and the provider against the SSH simulator, with no CLI and no network. | Under 2 s | | Export succeeds while the generated key is readable by others. | The bearer scenario's existing export now runs with that key. | No extra command | The remaining checks already had faster tests; see [Validation](#validation). ### How the two cleanup tests fit together The contract test pins what OpenTofu reports. The SDK test feeds the SDK copies of those reports. Each test's comment points to the other. | Engine state | Plan entry for the old container | |---|---| | Old container still running, on apply or teardown | `"deposed":"deadbeef"`, `["delete"]`, `before.id` = old ID | | Old container already gone | `"deposed":"deadbeef"`, `["no-op"]`, `before` and `after` null | OpenTofu reports no `resource_drift` entry for the old container in any of these plans, and the contract test asserts that too. So the copies match the real output on every field the SDK reads. The contract test checks plans and state only. Deleting the old container is OpenTofu's and the provider's job ([`docs/provider.md`](docs/provider.md#openshell-resource-lifecycles), [scope](docs/design/scope.md#upstream-boundaries)), so the test never runs `tofu apply` on the deposed container. ### Why the key check stays in a lifecycle scenario `docs/inference.md` promises that export does not need the inference key. Two things keep that true: readiness reads the key only during apply, and no provider reads it during refresh. A unit test could cover only one provider's refresh. The lifecycle scenario covers every provider and the SDK at once, and reusing its export costs no extra time. ## Validation ### Coverage I removed each production behavior the deleted scenario guarded, one at a time. For each removal I rebuilt the bundle from the changed code and ran the unit, integration and lifecycle tests. An unchanged control run passed everything. | Behavior removed | Tests that fail | |---|---| | Export refuses pending cleanup | SDK unit test of plan scope; `replacement_cleanup` (SDK) | | Apply accepts the old container's delete | Same SDK unit test; `replacement_cleanup` (SDK) | | Apply accepts an old container that is already gone | Same SDK unit test; `replacement_cleanup` (SDK) | | Destroy accepts the old container's delete | Two SDK unit tests; `replacement_cleanup` (SDK) | | Readiness checks the key's file mode | `nemoclaw-provider` unit test for vLLM readiness; proxy readiness contract test | | vLLM readiness reads the key | The same `nemoclaw-provider` unit test | | Refresh never reads the key (removed by making the OpenShell provider's refresh refuse an insecure key) | Only the bearer scenario, at its export | | Storage refuses a volume on another daemon | `nemoclaw-docker` storage unit test | | Storage refuses a substituted volume | None needed: `nemoclaw-tofu` refuses any change of bound ID, and the `service_storage` contract test asserts that through OpenTofu | The scenario's other checks repeated other scenarios. A failed plan or apply leaves state and the engine unchanged in the vLLM and Ollama `remote_service` scenarios. Teardown with an incompatible image runs in the same two scenarios. A second change showed where the export guarantee comes from. Making export plan the whole graph, readiness included, still passed the key check, because readiness defers its key read to apply. So the guarantee rests on readiness and refresh, not on how export builds its configuration. ### Runtime Local runs on macOS, two runs each, with the same bundle: | Test | `origin/v1` | This PR | |---|---|---| | Deleted scenario | 40.4 s, 40.3 s | — | | Bearer scenario | 34.0 s, 34.1 s | 34.4 s, 35.0 s | | Cleanup contract test | — | 1.9 s, 1.7 s | | **Summed** | **about 74 s** | **about 37 s** | CI times, from the two latest `v1` runs and this PR's run: | Platform | Deleted scenario on `v1` | Cleanup contract test on this PR | |---|---|---| | `linux_amd64` | 59.7 s, 67.9 s | 4.7 s | | `linux_arm64` | 58.7 s, 56.1 s | 2.5 s | | `darwin_arm64` | 80.9 s, 102.8 s | 4.2 s | | `windows_amd64` | 114.8 s, 91.7 s | Not run; the test is Unix-only | The bearer scenario's CI times on this PR stay within its range on `v1`. The `nemoclaw-provider` contract tests stay within their 82 s budget. ### Checks run `cargo ci` passed locally. I did not run `live-docker` or `live-kind` locally, because nothing that runs in images or on Kubernetes changed; CI ran both and they passed. CI's lifecycle tests passed on all four platforms. ### Limits - **No single end-to-end run.** OpenTofu's output and the SDK's handling of it are checked in two tests linked by copied shapes. If an OpenTofu or provider upgrade changes the shapes, the contract test fails and the SDK test's copies must be updated by hand. - **The old container is written into state by the test.** OpenTofu leaves an old container in state only for resources with `create_before_destroy`, which NemoClaw's graphs never set. The deleted scenario wrote this state by hand as well. Inference: the SDK handles a state that NemoClaw does not produce today. - **Unused simulator code.** The SSH simulator's `cleanup_failure` control no longer has a caller. Removing it changes code that every simulator request goes through, so it is left for a separate change.
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.
Part of #12882.
Failure
The pinned
kreuzwerker/dockerprovider waits 2 s before everydocker_networkread and after every removal. Every runtime plan, apply, export, or destroy reads the network once it exists, and a destroy also waits for the removal. Only theremote_servicelifecycle tests deploy a service with a Docker network: the SSH simulator is the only fake engine that serves/networks.I counted the network reads per test from a request log in the SSH simulator (local
linux_arm64bundle; the logging is not part of this change). The 12 tests made 75 reads, about 150 s of their 404 s of test time:managed_bearer_storage_or_key_damage_stops_plan_and_apply_without_changing_bindingsremote_model_reapply_and_drift_keep_bindings_and_stop_on_observation_failureremote_ollama_reapply_and_drift_keep_bindings_and_stop_on_observation_failuremanaged_bearer_credentials_survive_recovery_reapply_and_replacement_outside_statemanaged_pi_applies_without_generation_and_refused_sandbox_changes_keep_intentmanaged_bearer_replacement_cleanup_recovers_and_teardown_accepts_both_identitiesremote_model_apply_recovers_failed_creation_and_lost_process_or_cache_keeping_dataremote_ollama_apply_recovers_failed_creation_and_lost_process_or_cache_keeping_dataSeveral tests created and destroyed a runtime only to repeat checks that another scenario already ran against the same kind of runtime.
Decision
Run each check against one runtime per scenario, and only once. The Docker provider is unchanged.
remote_model_apply_recovers_failed_creation_and_lost_process_or_cache_keeping_datamanaged_bearer_credentials_survive_recovery_reapply_and_replacement_outside_state, against the same vLLM runtime with a bearer. Present-image compatibility runs in the Ollama and Pi tests, and the pull-policy plan runs in the Ollama test.remote_ollama_apply_recovers_…andremote_ollama_reapply_and_drift_…remote_ollama_recovers_reapplies_and_stops_on_observation_failure_keeping_data: recovery, then export and reapply, the transport failure, and teardown against the recovered runtime. The readiness gate, compute replacement plan, and pull-policy reapply do not depend on the runtime kind and run against vLLM inremote_model_reapply_and_drift_….managed_installers_accept_current_runtime_readiness_without_collecting_model_filesinnemoclaw-providercovers each runtime's readiness observation.managed_bearer_storage_or_key_damage_…andmanaged_bearer_replacement_cleanup_…managed_bearer_cleanup_recovers_damage_keeps_bindings_and_teardown_accepts_both_identities: the daemon retargeting, credential-volume damage, and insecure-key checks run against the state that replacement cleanup settles, before the teardown with both identities.service_storage::missing_foreign_or_substituted_storage_stops_plan_and_apply_without_changing_statecontract test, for both storage kinds, through pinned OpenTofu against a fake engine. The lifecycle test keeps one substituted volume to show the CLI stops before changing bindings.The partial-destroy and pulled-image tests are unchanged.
Validation
Local
linux_arm64run ofremote_service, same request log:After the change, by test: vLLM reapply 11, Ollama 9, bearer credentials 10, bearer cleanup and damage 12, Pi 6.
The new contract test asserts each refusal reason (
bound persistent storage is absent; recreation forbidden,observed ownership, generation, or durable identity changed).remote_serviceandservice_storagelifecycle tests pass locally;cargo fmt --all --checkandcargo clippy --workspace --all-targets -- -D warningsare clean.v1at a49fc77 does not compile the provider contract tests (kubernetes_lifecycle.rs). This branch carries the same fix as test: build the Kubernetes lifecycle workspace from the bundle #12981 in its own commit so CI can run, and mergingv1after test: build the Kubernetes lifecycle workspace from the bundle #12981 lands leaves one copy.CI lifecycle JUnit reports from run 38100630144, compared with the
v1run for perf(sdk): stop repeating bundle hashing and teardown state reads #12974 (38098264065), the latestv1run whose lifecycle tests ran. Cells are partition wall seconds / summed test seconds /remote_servicesummed seconds:remote_servicewent from 427 s to 291 s summed on linux_arm64, and from 456 s to 328 s on linux_amd64. Across the 9Rust desired-stateruns before perf(sdk): stop repeating bundle hashing and teardown state reads #12974, it ranged 446–454 s on linux_arm64. The network read counts above come from the local request log; CI runs the same commands. The linux_arm64 lifecycle step is still bounded by partition 1, which kept its share of theremote_servicetests and did not get shorter; partition 2 dropped 29 s.