Files
foxhunt/tests/test_validation.rs
jgrusewski 6093eac7bf 🔧 Tonic 0.14 Upgrade: Auto-generated and build system changes
Wave 64-65 cleanup: Proto regeneration and build system updates from Tonic 0.12→0.14 upgrade

Files updated:
- Cargo.lock: Dependency resolution for Tonic 0.14.2
- All build.rs: Updated for tonic-prost-build
- Proto files: Regenerated with tonic-prost 0.14
- Examples/tests: Updated for new gRPC API

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-03 07:34:26 +02:00

217 lines
6.6 KiB
Rust

#![allow(unused_crate_dependencies)]
/// Simple validation test to check that our integration test files are properly structured
/// This test doesn't require the full foxhunt modules to be available
use std::fs;
use std::path::Path;
#[test]
fn test_integration_files_exist() {
let test_files = vec![
"core_risk_integration_test.rs",
"data_ml_pipeline_test.rs",
"tli_orchestration_test.rs",
"end_to_end_trading_test.rs",
"module_integration_test.rs",
];
for test_file in test_files {
let path = Path::new(test_file);
assert!(
path.exists(),
"Integration test file {} should exist",
test_file
);
// Check file is not empty
let content = fs::read_to_string(path).expect("Should be able to read test file");
assert!(
!content.is_empty(),
"Integration test file {} should not be empty",
test_file
);
// Check file contains test functions
assert!(
content.contains("#[tokio::test]"),
"Test file {} should contain tokio tests",
test_file
);
println!("✓ Validated integration test file: {}", test_file);
}
}
#[test]
fn test_integration_test_structure() {
let test_files = vec![
(
"core_risk_integration_test.rs",
vec![
"test_hardware_timestamp_in_risk_checks",
"test_safe_arithmetic_in_var_calculations",
"test_lockfree_position_tracking",
],
),
(
"data_ml_pipeline_test.rs",
vec![
"test_end_to_end_data_ml_pipeline",
"test_realtime_streaming_feature_extraction",
"test_ml_safety_with_edge_case_data",
],
),
(
"tli_orchestration_test.rs",
vec![
"test_tli_server_module_orchestration",
"test_cross_module_workflow_coordination",
"test_tli_health_monitoring",
],
),
(
"end_to_end_trading_test.rs",
vec![
"test_complete_trading_workflow",
"test_high_frequency_trading_scenario",
"test_error_handling_and_recovery",
],
),
(
"module_integration_test.rs",
vec![
"test_all_module_interactions",
"test_core_risk_integration",
"test_data_ml_integration",
],
),
];
for (test_file, expected_tests) in test_files {
let content = fs::read_to_string(test_file).expect("Should be able to read test file");
for expected_test in expected_tests {
assert!(
content.contains(&format!("async fn {}", expected_test)),
"Test file {} should contain test function {}",
test_file,
expected_test
);
}
println!("✓ Validated test structure for: {}", test_file);
}
}
#[test]
fn test_integration_test_coverage() {
// Verify our integration tests cover all required scenarios from the original request
let required_integrations = vec![
("core -> risk integration", "core_risk_integration_test.rs"),
("data -> ml pipeline", "data_ml_pipeline_test.rs"),
(
"tli -> all modules communication",
"tli_orchestration_test.rs",
),
("end-to-end functionality", "end_to_end_trading_test.rs"),
];
for (integration_type, test_file) in required_integrations {
let path = Path::new(test_file);
assert!(
path.exists(),
"Required integration test for '{}' should exist in {}",
integration_type,
test_file
);
let content = fs::read_to_string(path).expect("Should be able to read test file");
// Check for comprehensive testing patterns
assert!(
content.contains("HardwareTimestamp"),
"Integration tests should use core timing infrastructure"
);
assert!(
content.contains("tokio::test"),
"Integration tests should be async"
);
assert!(
content.contains("assert!"),
"Integration tests should have assertions"
);
println!("✓ Validated integration coverage for: {}", integration_type);
}
}
#[test]
fn test_test_runner_configuration() {
// Verify test runner and configuration files exist
assert!(
Path::new("Cargo.toml").exists(),
"Test Cargo.toml should exist"
);
assert!(
Path::new("run_integration_tests.rs").exists(),
"Test runner binary should exist"
);
let cargo_content =
fs::read_to_string("Cargo.toml").expect("Should be able to read Cargo.toml");
assert!(
cargo_content.contains("foxhunt-integration-tests"),
"Cargo.toml should define integration test package"
);
assert!(
cargo_content.contains("tokio"),
"Cargo.toml should include tokio dependency"
);
let runner_content =
fs::read_to_string("run_integration_tests.rs").expect("Should be able to read test runner");
assert!(
runner_content.contains("cargo test"),
"Test runner should execute cargo test"
);
println!("✓ Validated test runner configuration");
}
#[test]
fn test_integration_test_quality() {
let test_files = vec![
"core_risk_integration_test.rs",
"data_ml_pipeline_test.rs",
"tli_orchestration_test.rs",
"end_to_end_trading_test.rs",
"module_integration_test.rs",
];
for test_file in test_files {
let content = fs::read_to_string(test_file).expect("Should be able to read test file");
// Check for HFT-specific performance testing
assert!(
content.contains("latency") || content.contains("performance"),
"Test file {} should include performance/latency testing",
test_file
);
// Check for error handling
assert!(
content.contains("Error") || content.contains("Result"),
"Test file {} should include error handling",
test_file
);
// Check for realistic test scenarios
assert!(
content.contains("AAPL") || content.contains("SPY") || content.contains("TEST"),
"Test file {} should include realistic trading symbols",
test_file
);
println!("✓ Validated test quality for: {}", test_file);
}
}