Skip to content

test(e2e): read and remove remote service networks less often - #12982

Merged
cv merged 3 commits into
v1from
test/fewer-docker-network-operations
Oct 11, 2026
Merged

cv merged 3 commits into
v1from
test/fewer-docker-network-operations

Conversation

@cv

@cv cv commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #12882.

Failure

The pinned kreuzwerker/docker provider waits 2 s before every docker_network read 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 the remote_service lifecycle 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_arm64 bundle; the logging is not part of this change). The 12 tests made 75 reads, about 150 s of their 404 s of test time:

Test Reads
managed_bearer_storage_or_key_damage_stops_plan_and_apply_without_changing_bindings 13
remote_model_reapply_and_drift_keep_bindings_and_stop_on_observation_failure 11
remote_ollama_reapply_and_drift_keep_bindings_and_stop_on_observation_failure 11
managed_bearer_credentials_survive_recovery_reapply_and_replacement_outside_state 10
managed_pi_applies_without_generation_and_refused_sandbox_changes_keep_intent 9
managed_bearer_replacement_cleanup_recovers_and_teardown_accepts_both_identities 7
remote_model_apply_recovers_failed_creation_and_lost_process_or_cache_keeping_data 7
remote_ollama_apply_recovers_failed_creation_and_lost_process_or_cache_keeping_data 7
partial-destroy and pulled-image tests (4) 0

Several 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.

Before After
remote_model_apply_recovers_failed_creation_and_lost_process_or_cache_keeping_data Removed. vLLM failed-creation, startup, lost-process, and cache recovery run in managed_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_… and remote_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 in remote_model_reapply_and_drift_…. managed_installers_accept_current_runtime_readiness_without_collecting_model_files in nemoclaw-provider covers each runtime's readiness observation.
managed_bearer_storage_or_key_damage_… and managed_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.
Missing, foreign, and substituted credential volumes through CLI plan and apply New service_storage::missing_foreign_or_substituted_storage_stops_plan_and_apply_without_changing_state contract 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.
Pi: failed-creation recovery, then an export after the last refusal Pi applies once; the bearer and Ollama tests own recovery. The export after the last refusal is dropped: the intent is byte-identical to the one the earlier export already reproduced, and the destroy that follows reads the same state.

The partial-destroy and pulled-image tests are unchanged.

Validation

  • Local linux_arm64 run of remote_service, same request log:

    Tests Network reads Summed test time Wall (4 threads)
    Before 12 75 404 s 110 s
    After 9 48 280 s 97 s

    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_service and service_storage lifecycle tests pass locally; cargo fmt --all --check and cargo clippy --workspace --all-targets -- -D warnings are clean.

  • v1 at 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 merging v1 after test: build the Kubernetes lifecycle workspace from the bundle #12981 lands leaves one copy.

  • CI lifecycle JUnit reports from run 38100630144, compared with the v1 run for perf(sdk): stop repeating bundle hashing and teardown state reads #12974 (38098264065), the latest v1 run whose lifecycle tests ran. Cells are partition wall seconds / summed test seconds / remote_service summed seconds:

    Partition Before After
    linux_arm64 / 1 198.8 / 788 / 175 200.2 / 795 / 171
    linux_arm64 / 2 178.0 / 711 / 252 149.3 / 587 / 120
    linux_amd64 / 1 221.0 / 878 / 209 208.0 / 825 / 186
    linux_amd64 / 2 174.0 / 696 / 247 165.6 / 654 / 142

    remote_service went from 427 s to 291 s summed on linux_arm64, and from 456 s to 328 s on linux_amd64. Across the 9 Rust desired-state runs 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 the remote_service tests and did not get shorter; partition 2 dropped 29 s.

cv added 2 commits October 10, 2026 17:53
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.
@cv cv added area: e2e End-to-end tests, nightly failures, or validation infrastructure v1 NemoClaw v1 branch labels Oct 11, 2026
v1 at a49fc77 does not compile the provider contract tests:
kubernetes_lifecycle.rs still passes paths to TofuWorkspace::new, which
now takes the bundle. This is the same change as #12981, so CI can run
the lifecycle tests on this branch; merging v1 after #12981 lands
leaves one copy.
@github-actions

Copy link
Copy Markdown
Contributor

@cv
cv merged commit 8d34abd into v1 Oct 11, 2026
@cv
cv deleted the test/fewer-docker-network-operations branch October 11, 2026 09:47
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.
@wscurran wscurran added the chore Build, CI, dependency, or tooling maintenance label Oct 28, 2026
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.
@cv cv added this to the Roadmap: GTC DC 2026 milestone Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: e2e End-to-end tests, nightly failures, or validation infrastructure chore Build, CI, dependency, or tooling maintenance v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants