Overview
VecLabs has a comprehensive test suite covering the Rust core, TypeScript SDK, Python SDK, and Solana program. The test suite includes:- 31 unit tests for the Rust HNSW core
- 6 Anchor tests for the Solana program (all passing on devnet)
- Jest tests for the TypeScript SDK
- pytest tests for the Python SDK
- 1 integration test for end-to-end validation
As of the latest build, 37 tests are passing across the entire codebase.
Running Rust Tests
The Rust core contains the most extensive test coverage, validating HNSW operations, distance calculations, Merkle trees, and encryption.Unit Tests
Integration Tests
The integration test validates end-to-end functionality including insert, query, delete, and serialization.Test Coverage by Module
The Rust test suite covers:HNSW Operations
Insert, query, delete, layer assignment, serialization
Distance Functions
Cosine similarity, Euclidean distance, dot product
Merkle Trees
Tree generation, proof creation, verification
Encryption
AES-256-GCM encrypt/decrypt for vector data
Running TypeScript Tests
The TypeScript SDK uses Jest as its test runner.TypeScript Test Configuration
Tests are configured inpackage.json:
Running Python Tests
The Python SDK uses pytest for testing.Python Requirements
The Python SDK requires Python 3.10+ and has the following dependencies:httpx>=0.25.0pydantic>=2.0.0typing-extensions>=4.0.0
Running Solana Program Tests
The Anchor program tests validate on-chain functionality including collection initialization and Merkle root updates.Solana Test Status
6/6 tests passing on the devnet deployment:
- Program:
8xjQ2XrdhR4JkGAdTEB7i34DBkbrLRkcgchKjN1Vn5nP - Test Collection:
8iLpyegDt8Vx2Q56kdvDJYpmnkTD2VDZvHXXead75Fm7
- Collection account initialization
- Merkle root updates and verification
- Authority management
- Storage account resizing
Running All Tests
To run the complete test suite across all components:Continuous Integration
VecLabs uses GitHub Actions for CI. The test badge shows current status:Test Performance
Test Execution Times
- Rust unit tests: ~2-3 seconds
- Rust integration test: ~5-8 seconds
- TypeScript tests: ~3-5 seconds
- Python tests: ~2-4 seconds
- Anchor tests: ~20-30 seconds (includes validator startup)
Troubleshooting
cargo test fails with linker errors
cargo test fails with linker errors
Clean the build cache and rebuild:
Anchor tests timeout or fail to connect
Anchor tests timeout or fail to connect
Ensure you have devnet SOL and the validator is accessible:
Jest tests fail with module not found
Jest tests fail with module not found
Rebuild the TypeScript SDK:
pytest not found
pytest not found
Install pytest in your Python environment:
Next Steps
Benchmarks
Run performance benchmarks to validate optimizations
Contributing
Learn how to contribute tests and features