impemented mock testing
This commit is contained in:
34
src/main.rs
34
src/main.rs
@@ -1,12 +1,4 @@
|
||||
mod mediator;
|
||||
mod sal;
|
||||
mod load;
|
||||
mod orchestrator;
|
||||
mod ui;
|
||||
mod engine;
|
||||
mod cli;
|
||||
|
||||
use miette::{Result, IntoDiagnostic, Diagnostic, Report, Context};
|
||||
use miette::{Result, IntoDiagnostic, Diagnostic, Report};
|
||||
use thiserror::Error;
|
||||
use std::sync::mpsc;
|
||||
use std::thread;
|
||||
@@ -25,16 +17,16 @@ use crossterm::{
|
||||
};
|
||||
use ratatui::{backend::CrosstermBackend, Terminal};
|
||||
|
||||
use cli::Cli;
|
||||
use mediator::{TelemetryState, UiCommand, BenchmarkPhase};
|
||||
use sal::traits::{AuditError, PlatformSal};
|
||||
use sal::mock::MockSal;
|
||||
use sal::heuristic::engine::HeuristicEngine;
|
||||
use sal::heuristic::discovery::SystemFactSheet;
|
||||
use load::{StressNg};
|
||||
use orchestrator::BenchmarkOrchestrator;
|
||||
use ui::dashboard::{draw_dashboard, DashboardState};
|
||||
use engine::OptimizationResult;
|
||||
use ember_tune_rs::cli::Cli;
|
||||
use ember_tune_rs::mediator::{TelemetryState, UiCommand, BenchmarkPhase};
|
||||
use ember_tune_rs::sal::traits::{AuditError, PlatformSal};
|
||||
use ember_tune_rs::sal::mock::MockSal;
|
||||
use ember_tune_rs::sal::heuristic::engine::HeuristicEngine;
|
||||
use ember_tune_rs::sal::heuristic::discovery::SystemFactSheet;
|
||||
use ember_tune_rs::load::{StressNg};
|
||||
use ember_tune_rs::orchestrator::BenchmarkOrchestrator;
|
||||
use ember_tune_rs::ui::dashboard::{draw_dashboard, DashboardState};
|
||||
use ember_tune_rs::engine::OptimizationResult;
|
||||
use owo_colors::OwoColorize;
|
||||
|
||||
#[derive(Error, Diagnostic, Debug)]
|
||||
@@ -109,11 +101,13 @@ fn main() -> Result<()> {
|
||||
|
||||
info!("ember-tune starting with args: {:?}", args);
|
||||
|
||||
let ctx = ember_tune_rs::sal::traits::EnvironmentCtx::production();
|
||||
|
||||
// 2. Platform Detection & Audit
|
||||
let (sal_box, facts): (Box<dyn PlatformSal>, SystemFactSheet) = if args.mock {
|
||||
(Box::new(MockSal::new()), SystemFactSheet::default())
|
||||
} else {
|
||||
HeuristicEngine::detect_and_build()?
|
||||
HeuristicEngine::detect_and_build(ctx)?
|
||||
};
|
||||
let sal: Arc<dyn PlatformSal> = sal_box.into();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user