Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/openshell-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ workspace = true

[features]
bundled-z3 = ["openshell-prover/bundled-z3"]
conformance = []

[dev-dependencies]
futures = { workspace = true }
Expand Down
91 changes: 91 additions & 0 deletions crates/openshell-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,27 @@ enum Commands {
command: Option<DoctorCommands>,
},

/// Validate that a gateway and its driver are functioning correctly.
///
/// Runs a suite of conformance scenarios against the configured gateway
/// and reports pass/fail for each. Exits non-zero if any scenario fails.
///
/// All sandboxes created by this command use the naming convention
/// `conformance-<scenario>-<run-id>` and are cleaned up on completion.
/// If the command is interrupted, any remaining sandboxes can be
/// identified by the `conformance-` prefix.
///
/// Examples:
/// openshell conformance run
/// openshell conformance run --filter lifecycle
/// openshell conformance run --timeout 120
#[cfg(feature = "conformance")]
#[command(hide = true, help_template = SUBCOMMAND_HELP_TEMPLATE)]
Conformance {
#[command(subcommand)]
command: ConformanceCommands,
},

// ===================================================================
// ADDITIONAL COMMANDS
// ===================================================================
Expand Down Expand Up @@ -1186,6 +1207,47 @@ enum InferenceCommands {
},
}

// -----------------------------------------------------------------------
// Conformance commands
// -----------------------------------------------------------------------

#[cfg(feature = "conformance")]
#[derive(Subcommand, Debug)]
enum ConformanceCommands {
/// Run the conformance suite against the configured gateway.
///
/// Connects to the gateway using the registered credentials and runs
/// each conformance scenario in sequence. Reports pass/fail per
/// scenario and exits non-zero if any scenario fails.
///
/// Examples:
/// openshell conformance run
/// openshell conformance run --filter lifecycle
/// openshell conformance run --timeout 120
#[command(help_template = LEAF_HELP_TEMPLATE, next_help_heading = "FLAGS")]
Run {
/// Only run scenarios whose name contains this substring.
#[arg(long, short = 'f')]
filter: Option<String>,

/// Seconds to wait for each scenario to complete.
#[arg(long, default_value = "300")]
timeout: u64,

/// Output format.
#[arg(short = 'o', long = "output", value_enum, default_value_t = OutputFormat::Table)]
output: OutputFormat,
},

/// List available conformance scenarios without running them.
#[command(help_template = LEAF_HELP_TEMPLATE, next_help_heading = "FLAGS")]
List {
/// Output format.
#[arg(short = 'o', long = "output", value_enum, default_value_t = OutputFormat::Table)]
output: OutputFormat,
},
}

// -----------------------------------------------------------------------
// Doctor (diagnostic) commands
// -----------------------------------------------------------------------
Expand Down Expand Up @@ -2062,6 +2124,35 @@ async fn main() -> Result<()> {
}
},

// -----------------------------------------------------------
// Conformance commands
// -----------------------------------------------------------
#[cfg(feature = "conformance")]
Some(Commands::Conformance { command }) => {
let ctx = resolve_gateway(&cli.gateway, &cli.gateway_endpoint)?;
let mut tls = tls.with_gateway_name(&ctx.name);
apply_auth(&mut tls, &ctx.name);
match command {
ConformanceCommands::Run {
filter,
timeout,
output,
} => {
run::conformance_run(
&ctx.endpoint,
&tls,
filter.as_deref(),
timeout,
output.as_str(),
)
.await?;
}
ConformanceCommands::List { output } => {
run::conformance_list(output.as_str())?;
}
}
}

// -----------------------------------------------------------
// Doctor (diagnostic) commands
// -----------------------------------------------------------
Expand Down
Loading
Loading