Repository navigation
test(testkit): add the testkit library for end-to-end suites - #4724
Open
matthewgrossman wants to merge 9 commits into
Open
matthewgrossman wants to merge 9 commits into
matthewgrossman wants to merge 9 commits into
Conversation
Add tests/testkit as its own Cargo workspace: testkit, testkit-macros, and testkit-spec. testkit reads a target file, connects to the gateway through openshell-sdk, creates and cleans up sandboxes, and runs the installed CLI. #[testkit::test] requires a stable ID and a doc comment and declares capability requirements. testkit-ready waits for a target's gateway and CLI before tests run. Nothing uses testkit yet. The lockfile is seeded from the root lockfile so shared crates resolve to the same versions. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Nothing else builds testkit, so check it in Branch Checks and the matching mise tasks to catch openshell-sdk changes that break it. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
🌿 Preview your docs: https://nvidia-preview-pr-4724.docs.buildwithfern.com/openshell |
Cleanup shared one two-minute budget across all of a test's sandboxes, so a slow delete left the rest with no time and could leak them on a shared gateway. Delete them concurrently, each with the full timeout. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Nothing reads test IDs or capability requirements until a runner, waivers, or result history exist, so remove the id and requires arguments and the target file's capabilities section. Both can return as optional attribute arguments without changing existing tests. With them gone, testkit-spec only checked the function shape and read the doc comment, so fold it into testkit-macros. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Replace the target file (OPENSHELL_TEST_TARGET) with the CLI's own gateway selection: OPENSHELL_GATEWAY_ENDPOINT, then OPENSHELL_GATEWAY, then the active gateway. A registered gateway's endpoint, auth mode, and mTLS material come from its CLI config directory. cx.cli runs OPENSHELL_BIN against the same gateway and workspace as the SDK. Suites now run unchanged under e2e/with-docker-gateway.sh and e2e/with-podman-gateway.sh, and environments need no extra file. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
matthewgrossman
marked this pull request as ready for review
October 19, 2026 22:37
matthewgrossman
requested review from
a team,
derekwaynecarr,
mrunalp and
sjenning
as code owners
October 19, 2026 22:37
This branch has not been deployed
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.
Summary
Adds
tests/testkit/, a support library for SDK-driven end-to-end suites, as its own Cargo workspace. This is a small first step to get the crate into main and checked in CI. Nothing uses it yet. A follow-up PR moves the existing suites onto it, starting withtests/suites/conformance, and each old suite is deleted when its replacement lands.The code comes from @elezar's draft #4629 (head
673928804). This PR takes only the testkit portion, adapted to current main and cut down to what's needed today (see "Deferred" below).Related Issue
Part of #3954
Changes
tests/testkit/: thetestkitandtestkit-macroscrates, plus thetestkit-readybinary, taken from test(conformance): run conformance suites from test plans in tmachine environments #4629.async fnmarked#[testkit::test]with a required doc comment.openshellCLI does:OPENSHELL_GATEWAY_ENDPOINT, thenOPENSHELL_GATEWAY, then the active gateway. A registered gateway's endpoint and mTLS material come from its CLI config directory.cx.clirunsOPENSHELL_BINagainst the same gateway and workspace. Each test logs the gateway it used.Cargo.lockis re-seeded from the root lockfile, because main'sopenshell-sdkhas more dependencies than when test(conformance): run conformance suites from test plans in tmachine environments #4629 was cut.rust:lint,rust:format,rust:format:check, andtest:rustmise tasks now run fmt, clippy, and nextest for the testkit workspace. This follows test(conformance): run conformance suites from test plans in tmachine environments #4629'scf72f1108, restricted to testkit.tests/testkit/README.mdcovers writing a test, whatContextprovides, and running against a gateway.TESTING.md,AGENTS.md, andCONTRIBUTING.mdpoint to it.Deferred
Dropped from #4629's testkit to keep this first step small. Each can come back without changing tests written in the meantime:
id = "t-…"). Until a runner, waivers, or result history need them, the nextest name identifies a test.requires = [...]. These belong with the runner, which selects tests per environment.testkit-speccrate, for listing tests without compiling them. It returns with the runner's catalog.OPENSHELL_TEST_TARGET). It held a copy of the CLI's registered gateway plus capabilities, so testkit now reads the CLI's gateway config directly. Step 3 then needs noopenshell_clientrole change.Also left out for later work:
Sessionlibrary, and the Ansible andconfig.nixchangese2e-suites.ymlKnown limitations:
cx.sandbox(...). Tests must delete anything else they create. This is documented in the README.Testing
cargo fmt --manifest-path tests/testkit/Cargo.toml --all -- --checkcargo clippy --locked --manifest-path tests/testkit/Cargo.toml --all-targets -- -D warningscargo nextest run --locked --config-file .config/nextest.toml --manifest-path tests/testkit/Cargo.toml(23 passed)tasks/scripts/check-cargo-lockfiles.shcoverstests/testkit/Cargo.lockmise run license:checkAgainst a real gateway
To check that testkit works end to end, I built a throwaway suite crate outside the repo. It depends on this branch's testkit and contains the six
sandbox_lifecycletests from #4629, plus a test that creates three sandboxes, checks thatcx.cli(["sandbox", "list"])shows them, and leaves them for cleanup. I ran it unchanged undere2e/with-docker-gateway.shon macOS with Docker Desktop. The wrapper's ownOPENSHELL_GATEWAYandOPENSHELL_BINwere the only configuration:e2e/with-docker-gateway.sh sh -c 'testkit-ready 120 && cargo nextest run --manifest-path <suite>/Cargo.toml --test-threads 1'testkit-readyresolved the wrapper's mTLS gateway, reported it healthy, and confirmed the CLI reaches it. All 7 tests passed in about 15s, andopenshell sandbox listshowed nothing left behind.On Docker Desktop, sandboxes need either Docker Desktop's host networking turned on (Settings → Resources → Network) or
supervisor_network_mode = "bridge". Otherwise the supervisor cannot reach a gateway on the Mac's loopback. For this run I set bridge mode with a local, uncommitted change to the wrapper's gateway config.Checklist