helia-interop
Interoperability testing and compatibility utilities for Helia IPFS implementations.
Overview
This crate provides utilities for testing and verifying interoperability between different Helia implementations and IPFS nodes. It includes test utilities, compatibility checking, and benchmarking tools.
Features
- Test Utilities: Helper functions for verifying Helia implementations
- Test Data Generation: Common patterns for generating test data
- Version Compatibility: Check version compatibility between implementations
- Benchmarking: Simple async benchmarking utilities
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Usage
Verifying Helia Instances
use verify_helia_basic;
use Arc;
async
Test Data Generation
use patterns;
// Generate test data
let data = generate_test_data; // 1KB of test data
assert_eq!;
// Use predefined patterns
let hello = HELLO_WORLD;
let empty = EMPTY;
let large = LARGE_TEXT;
Version Compatibility Checking
use VersionInfo;
let current_version = new;
let other_version = new;
let incompatible = new;
// Check compatibility
assert!;
assert!;
println!; // "1.0.0"
Benchmarking
use bench_async;
async
Modules
test_utils
Test utilities for verifying Helia implementations:
verify_helia_basic(): Verify basic Helia functionalitypatterns: Common test data patternsgenerate_test_data(size): Generate test dataHELLO_WORLD: "Hello, World!" bytesEMPTY: Empty bytesLARGE_TEXT: Lorem ipsum text
compat
Version compatibility utilities:
VersionInfo: Version information structnew(major, minor, patch): Create version infois_compatible_with(&other): Check compatibility- Display formatting (e.g., "1.2.3")
bench
Benchmarking utilities:
BenchResult: Benchmark result structavg_duration(): Average duration per iterationoperations_per_second(): Throughput calculation
bench_async(): Run async benchmarks
Examples
Full Integration Test
use ;
use Arc;
async
Testing
Run the test suite:
Current tests:
test_generate_test_data: Verify test data generationtest_version_compatibility: Verify version compatibility checkingtest_version_display: Verify version display formattingtest_bench_async: Verify async benchmarking
Use Cases
- Implementation Verification: Ensure your Helia implementation meets basic requirements
- Compatibility Testing: Verify different versions can work together
- Performance Testing: Benchmark operations across implementations
- Integration Testing: Test interactions between components
- Test Data Generation: Generate consistent test data for reproducible tests
Future Enhancements
- Protocol version negotiation
- Cross-implementation data exchange tests
- Network interop testing utilities
- CID format compatibility checking
- Codec compatibility verification
- More sophisticated benchmarking (percentiles, histograms)
- Test fixtures and common scenarios
- Compatibility matrices
Contributing
Contributions are welcome! Areas for improvement:
- Additional test patterns
- More comprehensive compatibility checks
- Enhanced benchmarking capabilities
- Real-world interop scenarios
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.