Skip to content

Commit a0eaebd

Browse files
committed
test(conformance): move scenario files into Cargo tests
Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent a9a635a commit a0eaebd

25 files changed

Lines changed: 252 additions & 251 deletions

File tree

‎.github/workflows/branch-checks.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ jobs:
141141
shell: nix develop -c bash -euo pipefail {0}
142142
run: |
143143
cargo fmt --all -- --check
144+
cargo fmt --manifest-path e2e/suites/conformance/Cargo.toml --all -- --check
144145
cargo fmt --manifest-path e2e/rust/Cargo.toml --all -- --check
145146
cargo fmt --manifest-path examples/governance-interceptor/Cargo.toml --all -- --check
146147
cargo fmt --manifest-path examples/supervisor-middleware-content-guard/Cargo.toml --all -- --check
@@ -196,6 +197,7 @@ jobs:
196197
shell: nix develop -c bash -euo pipefail {0}
197198
run: |
198199
cargo clippy --locked --workspace --all-targets -- -D warnings
200+
cargo clippy --locked --manifest-path e2e/suites/conformance/Cargo.toml --workspace --all-targets -- -D warnings
199201
cargo clippy --locked --manifest-path e2e/rust/Cargo.toml --all-targets -- -D warnings
200202
cargo clippy --locked --manifest-path examples/governance-interceptor/Cargo.toml --all-targets -- -D warnings
201203
cargo clippy --locked --manifest-path examples/supervisor-middleware-content-guard/Cargo.toml --all-targets -- -D warnings
@@ -235,6 +237,7 @@ jobs:
235237
OPENSHELL_TELEMETRY_ENABLED: "false"
236238
run: |
237239
cargo nextest run --locked --profile ci --workspace --features openshell-server/test-support
240+
cargo nextest run --locked --config-file .config/nextest.toml --profile ci --manifest-path e2e/suites/conformance/Cargo.toml --package openshell-test-conformance-cli -E 'binary(policy_advisor) & test(draft_assertion)'
238241
cargo nextest run --locked --config-file .config/nextest.toml --profile ci --manifest-path examples/supervisor-middleware-content-guard/Cargo.toml
239242
240243
rust-build-modes:

‎AGENTS.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Do not rely on this file for a full inventory. The detailed public and contribut
2222
| Path | Components | Purpose |
2323
|------|-----------|---------|
2424
| `crates/openshell-cli/` | CLI binary | User-facing command-line interface |
25-
| `crates/openshell-conformance/` | CLI conformance library | Reusable driver-agnostic scenarios and command runner |
25+
| `crates/openshell-conformance/` | Conformance test support | Command execution, polling, diagnostics, and cleanup |
2626
| `crates/openshell-server/` | Gateway server | Control-plane API, sandbox lifecycle, auth boundary |
2727
| `crates/openshell-sandbox/` | Sandbox runtime | Capability-free workload launcher, process identity, and seccomp-mediated I/O |
2828
| `crates/openshell-supervisor/` | Supervisor runtime | Gateway session, policy evaluation, credentials, and upstream networking |
@@ -61,6 +61,8 @@ Do not rely on this file for a full inventory. The detailed public and contribut
6161
| `python/openshell/` | Python SDK | Python bindings and CLI packaging |
6262
| `sdk/typescript/` | TypeScript SDK | Native Connect client, curated sandbox API, and generated protobuf types |
6363
| `proto/` | Protobuf definitions | gRPC service contracts |
64+
| `e2e/suites/` | Behavioral E2E suites | Directly authored conformance stories |
65+
| `tests/` | Test provisioning | Target configuration, artifact construction, and Ansible setup |
6466
| `deploy/` | Docker, Helm, K8s | Dockerfiles, Helm chart, manifests |
6567
| `docs/` | Published docs | MDX pages, navigation, and content assets |
6668
| `fern/` | Docs site config | Fern site config, components, and theme assets |

‎CI.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,14 @@ merge.
575575
Do not add the informational Actionlint, Zizmor, Dependency Review, or CodeQL
576576
jobs to the required status list while they remain in observation mode.
577577

578+
## Conformance source checks
579+
580+
Branch Rust checks format and lint the separate
581+
`e2e/suites/conformance` workspace.
582+
The Rust test jobs include the conformance runner in the root workspace and select the pure policy assertion
583+
tests in the conformance CLI package with the CI nextest profile, without a gateway. Gateway-backed CLI tests retain their driver E2E and installed-artifact
584+
integration lanes; source unit-test jobs do not execute those entry points.
585+
578586
## Nix download recovery
579587

580588
Jobs that enter the development shell enable `prepare-shell: "true"` on

‎TESTING.md‎

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@ mise run e2e # End-to-end tests (starts a Docker-backed gateway)
88
mise run ci # Everything: lint, compile checks, and tests
99
```
1010

11+
## Test Families
12+
13+
- Lint checks formatting, style, and static rules.
14+
- Unit tests verify a component in isolation.
15+
- Integration tests verify interactions between components.
16+
- End-to-end tests exercise a configured OpenShell target through a client.
17+
- Benchmarks measure performance or scale separately from behavioral correctness.
18+
19+
Conformance stories under `e2e/suites/conformance/` verify required public behavior.
20+
The [conformance guide](e2e/suites/conformance/README.md) owns their authoring and
21+
execution guidance. Driver and feature suites remain under `tests/suites/`;
22+
existing mixed suites remain under `e2e/rust/`. `tests/` also supplies provisioning
23+
and artifact construction.
24+
1125
## Test Layout
1226

1327
```text
@@ -16,6 +30,9 @@ crates/*/tests/ # Rust integration tests
1630
python/openshell/ # Python unit tests (*_test.py suffix)
1731
e2e/python/ # Python E2E tests (test_*.py prefix)
1832
e2e/rust/ # Rust CLI E2E tests
33+
e2e/suites/conformance/ # Conformance stories
34+
tests/suites/ # Existing feature and driver suites
35+
tests/ # Target provisioning and artifact construction
1936
```
2037

2138
## Rust Tests
@@ -210,10 +227,16 @@ When more than one test needs this behavior, put the transport in the shared
210227
Rust e2e harness and require callers to use it instead of duplicating DNS,
211228
HTTP `Host`, TLS SNI, and mTLS handling.
212229

230+
Conformance command execution, polling, diagnostics, and cleanup remain in
231+
`crates/openshell-conformance`. Story implementations live directly under
232+
`e2e/suites/conformance/cli/tests`. `mise run test:rust` includes runner and pure
233+
policy assertion tests without requiring a gateway. Existing Rust e2e tests
234+
retain their own harness.
235+
213236
Suites:
214237

215238
- Common suite (`--features e2e`) - driver-neutral CLI behavior, sandbox lifecycle, sync, port forwarding, policy, and provider tests.
216-
- CLI conformance (`tests/suites/conformance`) - portable Cargo tests for
239+
- CLI conformance (`e2e/suites/conformance`) - portable Cargo tests for
217240
lifecycle, mechanistic drafts, file transfer, and the sandbox-local API,
218241
including agent-authored permission requests. Driver E2E runs the complete
219242
Cargo test package. The installed-artifact conformance suite runs the same
@@ -251,7 +274,7 @@ cargo build --package openshell-cli
251274
OPENSHELL_BIN="$PWD/target/debug/openshell" \
252275
cargo test \
253276
--locked \
254-
--manifest-path tests/suites/conformance/Cargo.toml \
277+
--manifest-path e2e/suites/conformance/Cargo.toml \
255278
--package openshell-test-conformance-cli \
256279
--no-fail-fast \
257280
-- \

‎crates/openshell-conformance/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
[package]
55
name = "openshell-conformance"
6-
description = "Reusable OpenShell CLI conformance scenarios and runner"
6+
description = "OpenShell CLI conformance command runner and test support"
77
version.workspace = true
88
edition.workspace = true
99
rust-version.workspace = true
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Conformance test support
2+
3+
This crate provides the existing CLI command runner, bounded polling, structured
4+
output parsing, diagnostics, and explicit resource cleanup for conformance tests.
5+
6+
Conformance stories and their assertions live directly in
7+
[`e2e/suites/conformance`](../../e2e/suites/conformance/README.md). This crate does
8+
not define scenarios or maintain a registry; Cargo discovers the tests.
9+
10+
Runner consolidation with the existing Rust e2e harness remains separate work.

‎crates/openshell-conformance/src/lib.rs‎

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
//! Reusable support for portable `OpenShell` CLI conformance scenarios.
4+
//! Command execution, polling, diagnostics, and cleanup for `OpenShell` conformance tests.
55
66
pub mod executor;
7-
mod scenarios;
87

98
use std::collections::BTreeSet;
109
use std::error::Error;
1110
use std::fmt;
12-
use std::future::Future;
1311
use std::path::PathBuf;
14-
use std::pin::Pin;
1512
use std::process::ExitStatus;
1613
use std::sync::Arc;
1714
use std::time::{Duration, Instant};
@@ -23,28 +20,6 @@ use tokio::time::sleep;
2320

2421
use self::executor::{CliExecutionError, CliExecutor, ProcessCli};
2522

26-
pub use scenarios::{
27-
FILE_TRANSFER_GIT_FILTERING_SCENARIO, FILE_TRANSFER_PATH_SAFETY_SCENARIO,
28-
FILE_TRANSFER_ROUND_TRIP_SCENARIO, MECHANISTIC_PROPOSAL_SCENARIO,
29-
NEW_HOSTNAME_PROPOSAL_SCENARIO, POLICY_LOCAL_SCENARIO, SANDBOX_LIFECYCLE_SCENARIO,
30-
SMOKE_SCENARIO,
31-
};
32-
33-
/// A portable conformance scenario exercised by the Cargo test suite.
34-
#[derive(Debug)]
35-
pub struct Scenario {
36-
pub name: &'static str,
37-
run: for<'a> fn(&'a mut OpenShellRunner) -> ScenarioFuture<'a>,
38-
}
39-
40-
pub type ScenarioFuture<'a> = Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'a>>;
41-
42-
impl Scenario {
43-
pub async fn run(&self, runner: &mut OpenShellRunner) -> Result<(), String> {
44-
(self.run)(runner).await
45-
}
46-
}
47-
4823
const CLEANUP_TIMEOUT: Duration = Duration::from_mins(2);
4924
pub const STATUS_TIMEOUT: Duration = Duration::from_secs(30);
5025
const GATEWAY_STATUS_ATTEMPT_TIMEOUT: Duration = Duration::from_secs(10);

‎crates/openshell-conformance/src/scenarios/mod.rs‎

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎e2e/suites/conformance/Cargo.toml‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
[workspace]
5+
resolver = "2"
6+
members = ["cli"]
7+
8+
[workspace.lints.rust]
9+
unsafe_code = "warn"
10+
rust_2018_idioms = { level = "warn", priority = -1 }
11+
trivial_casts = "warn"
12+
trivial_numeric_casts = "warn"
13+
unused_lifetimes = "warn"
14+
unused_qualifications = "warn"
15+
16+
[workspace.lints.clippy]
17+
all = { level = "warn", priority = -1 }
18+
pedantic = { level = "warn", priority = -1 }
19+
nursery = { level = "warn", priority = -1 }
20+
21+
# Allow certain pedantic lints that are too noisy
22+
module_name_repetitions = "allow"
23+
must_use_candidate = "allow"
24+
missing_errors_doc = "allow"
25+
missing_panics_doc = "allow"
26+
27+
# Allow noisy nursery lints
28+
significant_drop_tightening = "allow" # Often gives incorrect suggestions
29+
missing_const_for_fn = "allow" # Too noisy for async code patterns
30+
31+
# Allow noisy pedantic lints
32+
too_many_lines = "allow" # Function length limits are subjective
33+
needless_pass_by_value = "allow" # Common pattern in async handlers
34+
ref_option = "allow" # Common pattern for optional references
35+
missing_fields_in_debug = "allow" # Manual Debug impls often intentionally omit fields

0 commit comments

Comments
 (0)