pub struct MockCommandRunner {Show 38 fields
pub inference_response: String,
pub inference_success: bool,
pub convert_success: bool,
pub tps: f64,
pub crash: bool,
pub inference_stderr: Option<String>,
pub profile_ci_unavailable: bool,
pub profile_ci_stderr: Option<String>,
pub inspect_success: bool,
pub validate_success: bool,
pub bench_success: bool,
pub check_success: bool,
pub profile_success: bool,
pub diff_tensors_success: bool,
pub compare_inference_success: bool,
pub custom_exit_code: Option<i32>,
pub profile_flamegraph_success: bool,
pub profile_focus_success: bool,
pub fingerprint_success: bool,
pub validate_stats_success: bool,
pub validate_strict_success: bool,
pub pull_success: bool,
pub pull_model_path: String,
pub inspect_json_success: bool,
pub inspect_tensor_names: Vec<String>,
pub ollama_success: bool,
pub ollama_response: String,
pub ollama_pull_success: bool,
pub ollama_create_success: bool,
pub serve_success: bool,
pub http_get_success: bool,
pub http_get_response: String,
pub profile_memory_success: bool,
pub chat_success: bool,
pub chat_response: String,
pub http_post_success: bool,
pub http_post_response: String,
pub spawn_serve_success: bool,
}Expand description
Mock command runner for testing
This struct uses many boolean flags intentionally - each flag controls an independent success/failure behavior for testing different scenarios.
Fields§
§inference_response: StringDefault response for inference
inference_success: boolWhether inference should succeed
convert_success: boolDefault response for convert
tps: f64Tokens per second to report
crash: boolSimulate a crash (negative exit code)
inference_stderr: Option<String>Custom stderr message for inference
Simulate profile_ci feature not available
profile_ci_stderr: Option<String>Custom stderr for profile_ci
inspect_success: boolWhether inspect should fail
validate_success: boolWhether validate should fail
bench_success: boolWhether bench should fail
check_success: boolWhether check should fail
profile_success: boolWhether profile should fail
diff_tensors_success: boolWhether diff_tensors should fail
compare_inference_success: boolWhether compare_inference should fail
custom_exit_code: Option<i32>Custom exit code (if Some, overrides normal exit code logic)
profile_flamegraph_success: boolWhether profile_with_flamegraph should fail
profile_focus_success: boolWhether profile_with_focus should fail
fingerprint_success: boolWhether fingerprint_model should fail
validate_stats_success: boolWhether validate_stats should fail
validate_strict_success: boolWhether validate_model_strict should fail
pull_success: boolWhether pull_model should succeed
pull_model_path: StringPath returned by pull_model on success
inspect_json_success: boolWhether inspect_model_json should succeed
inspect_tensor_names: Vec<String>Tensor names returned by inspect_model_json
ollama_success: boolWhether ollama inference should succeed
ollama_response: StringCustom response for ollama inference
ollama_pull_success: boolWhether ollama pull should succeed
ollama_create_success: boolWhether ollama create should succeed
serve_success: boolWhether serve_model should succeed
http_get_success: boolWhether http_get should succeed
http_get_response: StringCustom HTTP response body
profile_memory_success: boolWhether profile_memory should succeed
chat_success: boolWhether run_chat should succeed
chat_response: StringCustom response for chat
http_post_success: boolWhether http_post should succeed
http_post_response: StringCustom response for http_post
spawn_serve_success: boolWhether spawn_serve should succeed
Implementations§
Source§impl MockCommandRunner
impl MockCommandRunner
Sourcepub fn with_inference_response(self, response: impl Into<String>) -> Self
pub fn with_inference_response(self, response: impl Into<String>) -> Self
Set the inference response
Sourcepub fn with_inference_failure(self) -> Self
pub fn with_inference_failure(self) -> Self
Set whether inference should fail
Sourcepub fn with_convert_failure(self) -> Self
pub fn with_convert_failure(self) -> Self
Set whether convert should fail
Sourcepub fn with_crash(self) -> Self
pub fn with_crash(self) -> Self
Simulate a crash (negative exit code)
Sourcepub fn with_inference_response_and_stderr(
self,
response: impl Into<String>,
stderr: impl Into<String>,
) -> Self
pub fn with_inference_response_and_stderr( self, response: impl Into<String>, stderr: impl Into<String>, ) -> Self
Set the inference response with custom stderr
Simulate profile_ci feature not available
Sourcepub fn with_profile_ci_stderr(self, stderr: impl Into<String>) -> Self
pub fn with_profile_ci_stderr(self, stderr: impl Into<String>) -> Self
Set custom stderr for profile_ci
Sourcepub fn with_inspect_failure(self) -> Self
pub fn with_inspect_failure(self) -> Self
Set whether inspect should fail
Sourcepub fn with_validate_failure(self) -> Self
pub fn with_validate_failure(self) -> Self
Set whether validate should fail
Sourcepub fn with_bench_failure(self) -> Self
pub fn with_bench_failure(self) -> Self
Set whether bench should fail
Sourcepub fn with_check_failure(self) -> Self
pub fn with_check_failure(self) -> Self
Set whether check should fail
Sourcepub fn with_profile_failure(self) -> Self
pub fn with_profile_failure(self) -> Self
Set whether profile should fail
Sourcepub fn with_diff_tensors_failure(self) -> Self
pub fn with_diff_tensors_failure(self) -> Self
Set whether diff_tensors should fail
Sourcepub fn with_compare_inference_failure(self) -> Self
pub fn with_compare_inference_failure(self) -> Self
Set whether compare_inference should fail
Sourcepub fn with_exit_code(self, code: i32) -> Self
pub fn with_exit_code(self, code: i32) -> Self
Set a custom exit code for inference
Sourcepub fn with_profile_flamegraph_failure(self) -> Self
pub fn with_profile_flamegraph_failure(self) -> Self
Set whether profile_with_flamegraph should fail
Sourcepub fn with_profile_focus_failure(self) -> Self
pub fn with_profile_focus_failure(self) -> Self
Set whether profile_with_focus should fail
Sourcepub fn with_fingerprint_failure(self) -> Self
pub fn with_fingerprint_failure(self) -> Self
Set whether fingerprint_model should fail
Sourcepub fn with_validate_stats_failure(self) -> Self
pub fn with_validate_stats_failure(self) -> Self
Set whether validate_stats should fail
Sourcepub fn with_validate_strict_failure(self) -> Self
pub fn with_validate_strict_failure(self) -> Self
Set whether validate_model_strict should fail
Sourcepub fn with_pull_failure(self) -> Self
pub fn with_pull_failure(self) -> Self
Set whether pull_model should fail
Sourcepub fn with_pull_model_path(self, path: impl Into<String>) -> Self
pub fn with_pull_model_path(self, path: impl Into<String>) -> Self
Set the model path returned by pull_model
Sourcepub fn with_inspect_json_failure(self) -> Self
pub fn with_inspect_json_failure(self) -> Self
Set whether inspect_model_json should fail
Sourcepub fn with_tensor_names(self, names: Vec<String>) -> Self
pub fn with_tensor_names(self, names: Vec<String>) -> Self
Set custom tensor names for inspect_model_json
Sourcepub fn with_ollama_response(self, response: impl Into<String>) -> Self
pub fn with_ollama_response(self, response: impl Into<String>) -> Self
Set custom ollama inference response
Sourcepub fn with_ollama_failure(self) -> Self
pub fn with_ollama_failure(self) -> Self
Set whether ollama inference should fail
Sourcepub fn with_ollama_pull_failure(self) -> Self
pub fn with_ollama_pull_failure(self) -> Self
Set whether ollama pull should fail
Sourcepub fn with_ollama_create_failure(self) -> Self
pub fn with_ollama_create_failure(self) -> Self
Set whether ollama create should fail
Sourcepub fn with_serve_failure(self) -> Self
pub fn with_serve_failure(self) -> Self
Set whether serve_model should fail
Sourcepub fn with_http_get_failure(self) -> Self
pub fn with_http_get_failure(self) -> Self
Set whether http_get should fail
Sourcepub fn with_http_get_response(self, response: impl Into<String>) -> Self
pub fn with_http_get_response(self, response: impl Into<String>) -> Self
Set custom HTTP response body
Sourcepub fn with_profile_memory_failure(self) -> Self
pub fn with_profile_memory_failure(self) -> Self
Set whether profile_memory should fail
Sourcepub fn with_chat_failure(self) -> Self
pub fn with_chat_failure(self) -> Self
Set whether run_chat should fail
Sourcepub fn with_chat_response(self, response: impl Into<String>) -> Self
pub fn with_chat_response(self, response: impl Into<String>) -> Self
Set custom chat response
Sourcepub fn with_http_post_failure(self) -> Self
pub fn with_http_post_failure(self) -> Self
Set whether http_post should fail
Sourcepub fn with_http_post_response(self, response: impl Into<String>) -> Self
pub fn with_http_post_response(self, response: impl Into<String>) -> Self
Set custom http_post response
Sourcepub fn with_spawn_serve_failure(self) -> Self
pub fn with_spawn_serve_failure(self) -> Self
Set whether spawn_serve should fail
Trait Implementations§
Source§impl Clone for MockCommandRunner
impl Clone for MockCommandRunner
Source§fn clone(&self) -> MockCommandRunner
fn clone(&self) -> MockCommandRunner
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl CommandRunner for MockCommandRunner
impl CommandRunner for MockCommandRunner
Source§fn run_inference(
&self,
_model_path: &Path,
prompt: &str,
_max_tokens: u32,
_no_gpu: bool,
_extra_args: &[&str],
) -> CommandOutput
fn run_inference( &self, _model_path: &Path, prompt: &str, _max_tokens: u32, _no_gpu: bool, _extra_args: &[&str], ) -> CommandOutput
Source§fn convert_model(&self, _source: &Path, _target: &Path) -> CommandOutput
fn convert_model(&self, _source: &Path, _target: &Path) -> CommandOutput
Source§fn inspect_model(&self, _model_path: &Path) -> CommandOutput
fn inspect_model(&self, _model_path: &Path) -> CommandOutput
Source§fn validate_model(&self, _model_path: &Path) -> CommandOutput
fn validate_model(&self, _model_path: &Path) -> CommandOutput
Source§fn validate_model_strict(&self, _model_path: &Path) -> CommandOutput
fn validate_model_strict(&self, _model_path: &Path) -> CommandOutput
Source§fn bench_model(&self, _model_path: &Path) -> CommandOutput
fn bench_model(&self, _model_path: &Path) -> CommandOutput
Source§fn check_model(&self, _model_path: &Path) -> CommandOutput
fn check_model(&self, _model_path: &Path) -> CommandOutput
Source§fn profile_model(
&self,
_model_path: &Path,
_warmup: u32,
_measure: u32,
) -> CommandOutput
fn profile_model( &self, _model_path: &Path, _warmup: u32, _measure: u32, ) -> CommandOutput
Source§fn profile_ci(
&self,
_model_path: &Path,
min_throughput: Option<f64>,
max_p99: Option<f64>,
_warmup: u32,
_measure: u32,
) -> CommandOutput
fn profile_ci( &self, _model_path: &Path, min_throughput: Option<f64>, max_p99: Option<f64>, _warmup: u32, _measure: u32, ) -> CommandOutput
Source§fn diff_tensors(
&self,
_model_a: &Path,
_model_b: &Path,
json: bool,
) -> CommandOutput
fn diff_tensors( &self, _model_a: &Path, _model_b: &Path, json: bool, ) -> CommandOutput
Source§fn compare_inference(
&self,
_model_a: &Path,
_model_b: &Path,
_prompt: &str,
_max_tokens: u32,
_tolerance: f64,
) -> CommandOutput
fn compare_inference( &self, _model_a: &Path, _model_b: &Path, _prompt: &str, _max_tokens: u32, _tolerance: f64, ) -> CommandOutput
Source§fn profile_with_flamegraph(
&self,
_model_path: &Path,
_output_path: &Path,
_no_gpu: bool,
) -> CommandOutput
fn profile_with_flamegraph( &self, _model_path: &Path, _output_path: &Path, _no_gpu: bool, ) -> CommandOutput
Source§fn profile_with_focus(
&self,
_model_path: &Path,
_focus: &str,
_no_gpu: bool,
) -> CommandOutput
fn profile_with_focus( &self, _model_path: &Path, _focus: &str, _no_gpu: bool, ) -> CommandOutput
Source§fn fingerprint_model(&self, _model_path: &Path, json: bool) -> CommandOutput
fn fingerprint_model(&self, _model_path: &Path, json: bool) -> CommandOutput
Source§fn validate_stats(&self, _fp_a: &Path, _fp_b: &Path) -> CommandOutput
fn validate_stats(&self, _fp_a: &Path, _fp_b: &Path) -> CommandOutput
Source§fn pull_model(&self, _hf_repo: &str) -> CommandOutput
fn pull_model(&self, _hf_repo: &str) -> CommandOutput
apr pull --json <hf_repo> to acquire model from cache or remoteSource§fn inspect_model_json(&self, _model_path: &Path) -> CommandOutput
fn inspect_model_json(&self, _model_path: &Path) -> CommandOutput
apr rosetta inspect --json to get model metadata including tensor names Read moreSource§fn run_ollama_inference(
&self,
_model_tag: &str,
_prompt: &str,
_temperature: f64,
) -> CommandOutput
fn run_ollama_inference( &self, _model_tag: &str, _prompt: &str, _temperature: f64, ) -> CommandOutput
ollama run <model_tag> for parity testing (GH-6/AC-2)Source§fn pull_ollama_model(&self, _model_tag: &str) -> CommandOutput
fn pull_ollama_model(&self, _model_tag: &str) -> CommandOutput
ollama pull <model_tag> to acquire model (GH-6/AC-2)Source§fn create_ollama_model(
&self,
_model_tag: &str,
_modelfile_path: &Path,
) -> CommandOutput
fn create_ollama_model( &self, _model_tag: &str, _modelfile_path: &Path, ) -> CommandOutput
ollama create <tag> -f <modelfile> to register a GGUF with ollama (F-OLLAMA-005)Source§fn serve_model(&self, _model_path: &Path, _port: u16) -> CommandOutput
fn serve_model(&self, _model_path: &Path, _port: u16) -> CommandOutput
apr serve and return immediately (F-OLLAMA-004) Read moreSource§fn http_get(&self, _url: &str) -> CommandOutput
fn http_get(&self, _url: &str) -> CommandOutput
Source§fn profile_memory(&self, _model_path: &Path) -> CommandOutput
fn profile_memory(&self, _model_path: &Path) -> CommandOutput
apr profile --memory for memory usage (F-PERF-005)Source§fn run_chat(
&self,
_model_path: &Path,
prompt: &str,
_no_gpu: bool,
_extra_args: &[&str],
) -> CommandOutput
fn run_chat( &self, _model_path: &Path, prompt: &str, _no_gpu: bool, _extra_args: &[&str], ) -> CommandOutput
apr chat command with prompt piped via stdin (Bug 200)Source§fn http_post(&self, _url: &str, _body: &str) -> CommandOutput
fn http_post(&self, _url: &str, _body: &str) -> CommandOutput
Source§fn spawn_serve(
&self,
_model_path: &Path,
_port: u16,
_no_gpu: bool,
) -> CommandOutput
fn spawn_serve( &self, _model_path: &Path, _port: u16, _no_gpu: bool, ) -> CommandOutput
apr serve in background and return the child process PID (Bug 200) Read moreSource§impl Debug for MockCommandRunner
impl Debug for MockCommandRunner
Auto Trait Implementations§
impl Freeze for MockCommandRunner
impl RefUnwindSafe for MockCommandRunner
impl Send for MockCommandRunner
impl Sync for MockCommandRunner
impl Unpin for MockCommandRunner
impl UnwindSafe for MockCommandRunner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more