Repository navigation
test(sdk): run scripted OpenTofu tests concurrently - #13112
Merged
Merged
Conversation
#13056 avoided executables that a concurrently forked child kept busy in five ways: shell functions, a symlinked /bin/cat, /bin/sh symlinked as python3, scripts run through /bin/sh, and a retry loop. A child process now writes each test executable, so this process never holds it open for writing and no fork can inherit that descriptor. The SSH collector, recipe, vLLM launch, and SDK postcondition tests go back to plain scripts, and the scripted OpenTofu no longer needs its warm-up retry. The staged provider in nemoclaw-test-fixtures still runs through /bin/sh: the code under test writes that file, not the test.
The scripted tests serialized themselves because a child forked by another thread could keep a Deployment's lock file locked until it executed. Since #13056, Store::drop unlocks the file explicitly, so the shared lock is gone when an operation ends whatever descriptors remain. Without the mutex the SDK integration binary runs in about 5 s instead of 17 s under cargo test.
`deployment.rs` and `scripted_tofu.rs` now share one test bundle writer. Stacked on #13112. ## Why Both tests wrote a bundle whose manifest verifies. `scripted_tofu.rs` (#13081) kept a copy of `deployment.rs::write_bundle` that differed only for `libexec/tofu`, because `deployment.rs` also runs on Windows and the scripted copy needs Unix. ## Change - `tests/support/bundle.rs` adds `write_bundle(directory, tofu: Option<&str>)`. Without a script, every file is a non-executable fixture. With one, `libexec/tofu` is that script, written with `write_executable` from #13111. Passing a script on a platform other than Unix panics. - `deployment.rs` and `scripted_tofu.rs` call it and drop their own copies. I left two other duplicates alone: - `Events` in `nemoclaw-e2e/tests/helm_recovery.rs`, which is two methods long. - `Snapshot` there and `Untouched` in `kubernetes_interruption.rs`, which check different state. Both sit in other crates, so sharing them would mean adding them to `nemoclaw-test-fixtures` for little gain. ## Validation - `cargo test -p nemoclaw-sdk --test integration`: 444 passed. - `cargo ci` on linux_arm64: all steps passed. GitHub CI checks the Windows build of `deployment.rs`; I couldn't cross-compile it here.
…urrency # Conflicts: # crates/nemoclaw-sdk/tests/support/scripted_tofu.rs
Contributor
|
v1 documentation preview: https://nvidia-preview-nemoclaw-v1-pr-13112.docs.buildwithfern.com/nemoclaw |
This was referenced Oct 13, 2026
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.
Removes the mutex that made scripted OpenTofu tests run one at a time.
This branch also carries #13113, which merged into it: one shared
write_bundleintests/support/bundle.rsfordeployment.rsandscripted_tofu.rs.Why
scripted_tofu.rs(#13081) held a process-wideONE_AT_A_TIMEmutex for eachScriptedfixture. Its comment gave the reason: a child that another thread forks whileDeploymentholds its lock file keeps the lock until it calls exec, so the next operation could find the deployment locked. #13056 fixed that cause inStore::drop, which now unlocks the file explicitly, so the lock is released when an operation ends even if a child still holds a copy of the descriptor. Nextest already runs each test in its own process. The mutex only slowedcargo test, which runs tests as threads of one process.Change
Remove
ONE_AT_A_TIMEand the guard thatScriptedheld.Validation
cargo test -p nemoclaw-sdk --test integration: 12 rounds passed. The binary takes about 5 s instead of about 17 s.cargo test -p nemoclaw-sdk --test integration kubernetes_interruption -- --test-threads=32: 20 rounds passed.cargo cion linux_arm64: all steps passed.