Testing¶
DecentDB uses several complementary test layers.
Test layout¶
crates/decentdb/src/ # unit tests next to engine modules
crates/decentdb/tests/ # engine integration tests
crates/decentdb-cli/tests/ # CLI integration tests
tests/harness/ # crash/storage scenario runner + datasets
tests/bindings/ # binding smoke/validation programs
Core workspace validation¶
Run the main workspace suites from the repository root:
If you use the Cargo aliases from .cargo/config.toml, the equivalent shortcuts are:
Focused Rust test commands¶
Engine library/unit tests:
Engine integration tests:
CLI tests:
Crash/storage harness¶
The storage harness lives under tests/harness/.
Run one of the checked-in scenarios with:
python tests/harness/runner.py tests/harness/scenarios/short_crash.json
python tests/harness/runner.py tests/harness/scenarios/soak_storage.json
The runner shells out to cargo run -p decentdb --bin decentdb-test-harness. Scenario fixtures live under tests/harness/scenarios/, and reusable datasets live under tests/harness/datasets/.
Binding validation¶
Binding smoke/validation programs live under tests/bindings/:
tests/bindings/python/tests/bindings/dotnet/tests/bindings/c/tests/bindings/go/tests/bindings/java/tests/bindings/node/tests/bindings/dart/
See tests/bindings/README.md for the shared expectation that the Rust cdylib has been built first.
Package-local binding suites¶
Several language integrations also keep package-local tests under bindings/.
.NET packages¶
Python package¶
Go package¶
Java / JDBC package¶
Node packages¶
cd bindings/node/decentdb
DECENTDB_NATIVE_LIB_PATH=/absolute/path/to/target/debug/libdecentdb.so npm test
cd ../knex-decentdb
DECENTDB_NATIVE_LIB_PATH=/absolute/path/to/target/debug/libdecentdb.so npm test
Dart package¶
That script builds target/debug/libdecentdb.*, runs dart pub get, and then executes dart test for the packaged wrapper.
Benchmarks¶
The repository currently ships the release_metrics benchmark target:
Adding new tests¶
- Add unit tests next to the Rust module they exercise via
#[cfg(test)]. - Add engine integration tests under
crates/decentdb/tests/. - Add CLI integration tests under
crates/decentdb-cli/tests/. - Add new crash/storage scenarios under
tests/harness/scenarios/. - Add binding smoke coverage under
tests/bindings/<language>/. - Add package-local binding tests under the relevant
bindings/<language>/tree when the change affects a shipped host-language surface.
Every behavior-changing code change should include tests at the narrowest layer that proves the behavior.