RustRay is a mission-critical proxy core. High test coverage and reliability are our top priorities. This guide explains our testing architecture and how to contribute new tests.
Located within the src/ directory alongside the implementation.
- Focus on individual logic, data structures, and codec handling.
- Run with:
cargo test --lib
Located in the tests/ directory. These test how different components of the core interact.
- Protocol Muxing:
tests/mux_tests.rs - QUIC Stability:
tests/brutal_quic_test.rs - P2P Resilience:
tests/mesh_resilience_test.rs - Phase 10 Mesh Intelligence:
tests/phase10_mesh_intelligence_test.rs - gRPC API Integration:
tests/grpc_integration.rs - FFI Stealth:
tests/ffi_stealth_test.rs - Run with:
cargo test --test <name>
Specialized tests for our kernel-level packet manipulation.
- Requirement: Must be run on Linux with root privileges to load eBPF programs.
- Files:
tests/ebpf_integrity.rstests/handshake_forensics_test.rstests/ebpf_fragmentation_test.rs
- Run with:
sudo cargo test --test ebpf_integrity
We use cargo-fuzz for testing our codecs (VLESS, VMess, Flow-J) against malicious edge cases.
- Directory:
fuzz/ - Run with:
cargo fuzz run <target>
Performance is key. We use criterion for high-precision benchmarking.
- Directory:
benches/ - Run with:
cargo bench
Every Pull Request automatically triggers our GitHub Actions workflow which runs:
cargo check --workspacecargo clippy --workspace -D warningscargo test --workspacecargo fmt --check
When adding a new feature:
- Add Unit Tests: Cover the edge cases for the new logic.
- Add an Integration Test: If it's a new transport or protocol, add it to
tests/. - Run existing tests: Ensure no regressions in stability (
tests/stability_e2e.rs).
#[tokio::test]
async fn test_new_protocol_handshake() {
let (server, client) = setup_mock_pair().await;
// ... perform handshake ...
assert!(handshake.is_success());
}Need help with a complex scenario? Reach out on our Discord. 🚀