Files
foxhunt/services/load_tests/src/main.rs
jgrusewski 030a15ee05 🔧 Emergency Fix: Resolve catastrophic _i32 suffix corruption (463→0 errors)
- Fixed systematic array indexing corruption: [0_i32] → [0]
- Fixed numeric literal suffixes across 835 files
- Fixed iterator patterns on RwLockReadGuard (.iter() required)
- Fixed float type annotations (365.25_f64 for sqrt)
- Fixed missing semicolons in position manager
- Fixed reference dereferencing in data loader

Root cause: Mass refactoring incorrectly added _i32 suffixes to array indices
Impact: Complete compilation failure (463 errors)
Resolution: Automated regex + targeted fixes
Result: 100% compilation success (0 errors)

Validated: cargo check --workspace passes
Ready for: Production deployment
2025-10-10 23:05:26 +02:00

78 lines
2.4 KiB
Rust

//! Load Testing Binary - Throughput Validator
//!
//! Orchestrates and runs comprehensive load tests for trading service
use anyhow::Result;
use clap::Parser;
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
mod scenarios;
mod metrics;
mod clients;
#[derive(Parser, Debug)]
#[command(name = "throughput_validator")]
#[command(about = "Trading Service Load Testing and Throughput Validation", long_about = None)]
struct Args {
/// Test scenario to run
#[arg(short, long, default_value = "all")]
scenario: String,
/// Trading service URL
#[arg(short, long, default_value = "http://localhost:50051")]
url: String,
/// Output report path
#[arg(short, long, default_value = "/tmp/WAVE_120_AGENT_5_LOAD_TESTING.md")]
output: String,
/// Enable verbose logging
#[arg(short, long)]
verbose: bool,
}
#[tokio::main]
async fn main() -> Result<()> {
let args = Args::parse();
// Initialize tracing
let log_level = if args.verbose { "debug" } else { "info" };
tracing_subscriber::registry()
.with(
tracing_subscriber::EnvFilter::try_from_default_env()
.unwrap_or_else(|_| format!("load_tests={log_level},tower_http=debug").into()),
)
.with(tracing_subscriber::fmt::layer())
.init();
println!("\n🚀 Foxhunt Load Testing - Throughput Validator");
let separator = "=".repeat(80);
println!("{separator}\n");
// Run selected scenario
let report = match args.scenario.as_str() {
"sustained" => scenarios::sustained_load::run(&args.url).await?,
"burst" => scenarios::burst_load::run(&args.url).await?,
"streaming" => scenarios::streaming_load::run(&args.url).await?,
"pool" => scenarios::pool_saturation::run(&args.url).await?,
"all" => scenarios::comprehensive::run(&args.url).await?,
_ => {
let scenario = &args.scenario;
tracing::error!("❌ Unknown scenario: {scenario}");
tracing::info!("Available scenarios: sustained, burst, streaming, pool, all");
std::process::exit(1);
}
};
// Write report to file
tokio::fs::write(&args.output, report.to_markdown()).await?;
println!("\n✅ Load testing complete!");
let output = &args.output;
println!("📊 Report saved to: {output}");
let separator = "=".repeat(80);
println!("{separator}\n");
Ok(())
}