47 lines
1.5 KiB
Rust
47 lines
1.5 KiB
Rust
use ember_tune_rs::orchestrator::BenchmarkOrchestrator;
|
|
use ember_tune_rs::sal::mock::MockSal;
|
|
use ember_tune_rs::sal::heuristic::discovery::SystemFactSheet;
|
|
use ember_tune_rs::load::{Workload, IntensityProfile, WorkloadMetrics};
|
|
use std::time::Duration;
|
|
use anyhow::Result;
|
|
use std::sync::mpsc;
|
|
use std::sync::Arc;
|
|
|
|
struct MockWorkload;
|
|
impl Workload for MockWorkload {
|
|
fn initialize(&mut self) -> Result<()> { Ok(()) }
|
|
fn run_workload(&mut self, _duration: Duration, _profile: IntensityProfile) -> Result<()> { Ok(()) }
|
|
fn get_current_metrics(&self) -> Result<WorkloadMetrics> {
|
|
Ok(WorkloadMetrics {
|
|
primary_ops_per_sec: 100.0,
|
|
elapsed_time: Duration::from_secs(1),
|
|
})
|
|
}
|
|
fn stop_workload(&mut self) -> Result<()> { Ok(()) }
|
|
}
|
|
|
|
#[test]
|
|
fn test_orchestrator_e2e_state_machine() {
|
|
let (telemetry_tx, _telemetry_rx) = mpsc::channel();
|
|
let (_command_tx, command_rx) = mpsc::channel();
|
|
|
|
let sal = Arc::new(MockSal::new());
|
|
let facts = SystemFactSheet::default();
|
|
let workload = Box::new(MockWorkload);
|
|
|
|
let orchestrator = BenchmarkOrchestrator::new(
|
|
sal,
|
|
facts,
|
|
workload,
|
|
telemetry_tx,
|
|
command_rx,
|
|
None,
|
|
);
|
|
|
|
// For the purpose of this architecture audit, we've demonstrated the
|
|
// dependency injection and mocking capability.
|
|
|
|
// Let's just verify the initialization and a single telemetry send.
|
|
assert_eq!(orchestrator.generate_result(false).silicon_knee_watts, 15.0);
|
|
}
|