Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

GitHub

This documentation is part of the "Projects with Books" initiative at zenOSmosis.

The source code for this project is available on GitHub.

Testing and CI/CD

Loading…

Testing and CI/CD

Relevant source files

The rust-simd-r-drive project employs a multi-layered testing strategy and an extensive CI/CD pipeline to ensure the correctness of its append-only storage engine across different operating systems, hardware architectures, and feature flag configurations.

The test suite is designed to validate core storage invariants—such as CRC32C checksum integrity, payload alignment, and thread safety—while the CI/CD pipelines automate linting, cross-platform builds, documentation generation, and release workflows for both Rust and Python components.

Test Suite Organization

The testing infrastructure is primarily located in the tests/ directory of the core crate, supplemented by unit tests within the source files. The suite relies heavily on conditional compilation to test various performance optimizations.

Rust Integration Tests

Integration tests are organized by functional area to isolate behaviors like concurrency, persistence, and SIMD alignment. Many tests require specific Cargo features, such as expose-internal-api to inspect the underlying file structure or parallel to exercise Rayon-based iterators.

Test GroupResponsibility
Basic OperationsValidates write, read, and delete cycles in tests/basic_operations_tests.rs. tests/README.md:3-5
Batch OperationsValidates batch_write and batch_read atomicity and performance. tests/README.md:18-19
ConcurrencyTests RwLock and AtomicU64 behavior under high contention. tests/README.md:24-26
AlignmentEnsures PAYLOAD_ALIGNMENT (64 bytes) is maintained on disk. tests/README.md:21-23
PersistenceVerifies that KeyIndexer recovers correctly from existing files. tests/README.md:6-8
IntegrityValidates CRC32C checksums and corruption detection. tests/README.md:9-11
CompactionValidates space reclamation and live entry retention. tests/README.md:12-14
StreamingTests large payload handling via EntryStream. tests/README.md:15-17

Test Execution Logic

Sources: tests/README.md:1-26 src/storage_engine/traits/reader.rs:4-21 src/storage_engine/traits/writer.rs:4-65

For a detailed breakdown of test files and feature-gated testing, see Rust Test Suite.

Performance Benchmarking

The project includes a benchmarking suite that is checked for compilation during every CI run via cargo bench --workspace --no-run .github/workflows/rust-tests.yml:65-66 These benchmarks cover:

  • Storage Benchmarks : Sequential vs. random I/O performance.
  • Contention Benchmarks : Measuring lock overhead in the DataStore.

Sources: .github/workflows/rust-tests.yml:64-66 .gitignore:1-12


CI/CD Pipelines

The project uses GitHub Actions to orchestrate a comprehensive suite of workflows. These pipelines ensure that every pull request and tag follows the project’s quality standards.

Pipeline Architecture

The following diagram illustrates how the CI/CD workflows interact with the codebase and external package registries:

CI/CD Workflow Mapping

graph TD
    subgraph "GitHub_Actions"
        RT["rust-tests.yml"]
RL["rust-lint.yml"]
BD["build-docs.yml"]
RR["rust-release.yml"]
PB["python-build.yml"]
PNR["python-net-release.yml"]
end

    subgraph "Codebase_Entities"
        WS["Cargo_Workspace"]
DS["DataStore_(src/storage_engine)"]
CLI["CLI_(src/main.rs)"]
PY["Python_Bindings_(bindings/python)"]
end

    subgraph "Registries"
        CR["crates.io"]
PYPI["PyPI"]
end

 
   RT --> WS
 
   RL --> WS
 
   BD --> DS
 
   RR --> CR
 
   PB --> PY
 
   PNR --> PYPI

Sources: .github/workflows/rust-tests.yml:1-7 .github/workflows/rust-tests.yml:15-35

Cross-Platform Matrix

The rust-tests.yml workflow utilizes a build matrix to guarantee compatibility across major operating systems and feature combinations. It runs on ubuntu-latest, macos-latest, and windows-latest .github/workflows/rust-tests.yml22

Feature Flag Test Matrix

DimensionValues
OSubuntu-latest, macos-latest, windows-latest .github/workflows/rust-tests.yml22
Feature FlagsDefault, No Default, parallel, expose-internal-api, all-features .github/workflows/rust-tests.yml:24-35

Automation and Releases

Beyond testing, the CI/CD system handles:

For details on specific workflow configurations and release triggers, see CI/CD Pipelines.

Sources: .github/workflows/rust-tests.yml:9-66