An open API service indexing awesome lists of open source software.

https://github.com/dirvine/saorsa-test-suite

Comprehensive test suite for Saorsa Core P2P library with data integrity verification and distributed network testing capabilities
https://github.com/dirvine/saorsa-test-suite

Last synced: 8 months ago
JSON representation

Comprehensive test suite for Saorsa Core P2P library with data integrity verification and distributed network testing capabilities

Awesome Lists containing this project

README

          

# Saorsa Test Suite

[![Crates.io](https://img.shields.io/crates/v/saorsa-test-suite.svg)](https://crates.io/crates/saorsa-test-suite)
[![Documentation](https://docs.rs/saorsa-test-suite/badge.svg)](https://docs.rs/saorsa-test-suite)
[![CI](https://github.com/dirvine/saorsa-test-suite-foundation/workflows/CI/badge.svg)](https://github.com/dirvine/saorsa-test-suite-foundation/actions)
![Test Results](https://img.shields.io/badge/tests-720%20passed-brightgreen)
![Global Coverage](https://img.shields.io/badge/coverage-6%20regions-blue)
![Pre-Release](https://img.shields.io/badge/status-pre--release-orange)

Comprehensive test suite for Saorsa Core P2P library with data integrity verification and distributed network testing capabilities.

## 🎯 Latest Test Results

### Local Testing
- **64/64** unit tests passing (100% success rate)
- **9/9** DHT v2 integration tests passing
- **Zero** compilation warnings or errors

### Global P2P Testing (2025-08-15)
Successfully tested across **6 global regions** with exceptional results:

| Metric | Result |
|--------|--------|
| **Total Tests** | 720/720 passed |
| **Global Regions** | NYC, SFO, LON, FRA, SGP, SYD |
| **Network Topology** | Full mesh (15 connections) |
| **Average Latency** | 156ms (global average) |
| **Best Latency** | 23ms (LON↔FRA) |
| **Worst Latency** | 295ms (LON↔SYD) |
| **Throughput** | 32,592 req/s |
| **Concurrent Connections** | 6000+ |
| **Resource Usage** | <5% CPU average |

📊 **[View Full Test Report](./REMOTE_TEST_REPORT.md)** | **[View Test Data](./global_test_results.json)**

## Features

- **Comprehensive Testing**: Full test coverage for P2P networking components
- **Data Integrity Verification**: Cryptographic verification of data transmission
- **Remote Network Testing**: Distributed testing across multiple nodes
- **Performance Benchmarking**: Built-in performance measurement and reporting
- **Stress Testing**: Load testing for network resilience validation
- **MLS Protocol Testing**: Group communication security verification
- **CLI Interface**: Command-line tool for automated testing workflows

## Architecture

The test suite provides multiple testing modes and verification mechanisms:

### Core Testing Components

- **Network Connectivity Tests**: Verify P2P network formation and stability
- **DHT Operations**: Distributed hash table functionality validation
- **Message Transmission**: End-to-end message delivery verification
- **Cryptographic Operations**: Encryption/decryption and signature validation
- **Reed-Solomon Encoding**: Error correction and data recovery testing
- **Geographic Routing**: Location-aware routing verification

### Test Types

- **Unit Tests**: Individual component functionality
- **Integration Tests**: Multi-component interaction validation
- **Stress Tests**: High-load and failure scenario testing
- **Performance Tests**: Latency and throughput benchmarking
- **Security Tests**: Cryptographic and protocol security validation

## Installation

Add this to your `Cargo.toml`:

```toml
[dependencies]
saorsa-test-suite = "0.1.0"
```

Or install the CLI tool:

```bash
cargo install saorsa-test-suite
```

## Usage

### CLI Tool

Run the complete test suite:

```bash
saorsa-test-suite --config test-config.toml
```

Run specific test categories:

```bash
# Network connectivity tests
saorsa-test-suite --test-type network

# Cryptographic verification
saorsa-test-suite --test-type crypto

# Performance benchmarks
saorsa-test-suite --test-type performance

# MLS protocol tests
saorsa-test-suite --test-type mls
```

### Programmatic Usage

```rust
use saorsa_test_suite::{TestRunner, TestConfig, TestType};

#[tokio::main]
async fn main() -> Result<(), Box> {
// Create test configuration
let config = TestConfig::builder()
.test_types(vec![TestType::Network, TestType::Crypto])
.node_count(10)
.duration(Duration::from_secs(300))
.data_verification(true)
.build();

// Initialize test runner
let mut runner = TestRunner::new(config).await?;

// Execute tests
let results = runner.run_tests().await?;

// Generate report
let report = results.generate_report();
println!("{}", report);

Ok(())
}
```

### Test Infrastructure

The test suite has been validated on DigitalOcean's global infrastructure:

- **7 nodes** deployed globally (1 coordinator + 6 test nodes)
- **Instance type**: basic-xxs ($0.007/hour per node)
- **Deployment**: Docker containers via App Platform
- **Configuration**: See [global-app.yaml](./global-app.yaml)

### Remote Testing

Test across multiple remote nodes:

```rust
use saorsa_test_suite::{RemoteTestRunner, RemoteConfig};

#[tokio::main]
async fn main() -> Result<(), Box> {
let config = RemoteConfig::builder()
.nodes(vec![
"user@node1.example.com",
"user@node2.example.com",
"user@node3.example.com",
])
.ssh_key_path("~/.ssh/id_rsa")
.test_duration(Duration::from_secs(600))
.build();

let mut runner = RemoteTestRunner::new(config).await?;
let results = runner.run_distributed_tests().await?;

println!("Test Results: {:#?}", results);

Ok(())
}
```

## Configuration

Create a test configuration file:

```toml
# test-config.toml

[general]
node_count = 10
test_duration = "5m"
log_level = "info"
output_format = "json"

[network]
bootstrap_nodes = [
"127.0.0.1:8080",
"127.0.0.1:8081"
]
network_timeout = "30s"

[crypto]
verify_signatures = true
test_key_rotation = true
quantum_resistant = false

[performance]
max_latency_ms = 1000
min_throughput_mbps = 10
benchmark_duration = "2m"

[remote]
ssh_key = "~/.ssh/id_rsa"
deployment_timeout = "60s"

[[remote.nodes]]
host = "test-node-1.example.com"
user = "ubuntu"
port = 22

[[remote.nodes]]
host = "test-node-2.example.com"
user = "ubuntu"
port = 22
```

## Test Categories

### Network Tests

- **Bootstrap Connectivity**: Node discovery and initial connection
- **Peer Discovery**: Dynamic peer finding and connection establishment
- **Message Routing**: End-to-end message delivery verification
- **Network Partitioning**: Resilience to network splits and recovery
- **Geographic Routing**: Location-aware message routing

### Cryptographic Tests

- **Key Generation**: Ed25519 and X25519 key pair generation
- **Digital Signatures**: Message signing and verification
- **Encryption/Decryption**: ChaCha20Poly1305 AEAD operations
- **Key Derivation**: HKDF-based key derivation verification
- **Forward Secrecy**: Key rotation and perfect forward secrecy

### MLS Protocol Tests

- **Group Creation**: Secure group establishment
- **Member Management**: Adding and removing group members
- **Message Security**: Encrypted group communication
- **Key Rotation**: Automatic key refresh mechanisms
- **Protocol Compliance**: RFC 9420 compliance verification

### Performance Tests

- **Latency Measurement**: Round-trip time analysis
- **Throughput Testing**: Data transfer rate measurement
- **Scalability Tests**: Performance with increasing node counts
- **Resource Usage**: Memory and CPU utilization monitoring
- **Stress Testing**: High-load scenario validation

## Data Verification

The test suite includes comprehensive data integrity verification:

```rust
use saorsa_test_suite::verification::{DataVerifier, VerificationMode};

// Create data verifier
let verifier = DataVerifier::new(VerificationMode::Cryptographic);

// Generate test data with checksums
let test_data = verifier.generate_test_data(1024 * 1024).await?;

// Verify data integrity after transmission
let is_valid = verifier.verify_data(&received_data, &test_data.checksum).await?;
assert!(is_valid);
```

## Remote Testing

Deploy and run tests across multiple nodes:

```bash
# Deploy test suite to remote nodes
saorsa-test-suite deploy --config remote-config.toml

# Run distributed network test
saorsa-test-suite remote-test --nodes 10 --duration 10m

# Collect and analyze results
saorsa-test-suite collect-results --output results.json
```

## Reporting

Generate comprehensive test reports:

```rust
use saorsa_test_suite::reporting::{ReportGenerator, ReportFormat};

let generator = ReportGenerator::new(ReportFormat::Html);
let report = generator.generate_report(&test_results).await?;

// Save report to file
report.save_to_file("test-report.html").await?;
```

Report formats:
- **HTML**: Interactive web-based reports with charts
- **JSON**: Machine-readable structured data
- **Markdown**: Human-readable text reports
- **CSV**: Tabular data for analysis

## Performance Monitoring

Real-time performance monitoring during tests:

```rust
use saorsa_test_suite::monitoring::{PerformanceMonitor, Metric};

let monitor = PerformanceMonitor::new();

// Track network metrics
monitor.track(Metric::NetworkLatency)?;
monitor.track(Metric::Throughput)?;
monitor.track(Metric::PacketLoss)?;

// Get real-time statistics
let stats = monitor.get_current_stats().await?;
println!("Current latency: {}ms", stats.avg_latency);
```

## Contributing

Contributions are welcome! Please read our contributing guidelines and submit pull requests to our GitHub repository.

## Testing

Run the test suite:

```bash
cargo test --all-features
```

Run integration tests:

```bash
cargo test --test integration
```

Run performance benchmarks:

```bash
cargo bench
```

## License

This project is dual-licensed under:
- GNU Affero General Public License v3.0 or later (AGPL-3.0-or-later)
- Commercial License

For AGPL-3.0 license details, see [LICENSE-AGPL-3.0](LICENSE-AGPL-3.0).
For commercial licensing, contact: saorsalabs@gmail.com

## Project Status

**⚠️ PRE-RELEASE ALPHA**

This test suite is in active development and not yet ready for production use. Current status:

- ✅ Core functionality implemented
- ✅ Local tests passing (64/64)
- ✅ Global infrastructure validated (6 regions)
- 🚧 API may change before 1.0 release
- 🚧 Additional test scenarios being developed
- 🚧 Documentation being expanded

## Test Reports

- [Local Test Report](./TEST_REPORT.md) - Local testing results
- [Remote Test Report](./REMOTE_TEST_REPORT.md) - Global P2P test results
- [Test Data](./global_test_results.json) - Raw test metrics

## Security

For security issues, please contact: saorsalabs@gmail.com

Do not report security vulnerabilities through public GitHub issues.