Testing

AionDB includes several test and validation layers. This page is for users and contributors who want to understand the public testing story without reading crate internals.

Rust tests

Run the workspace tests with Cargo when you need broad validation:

cargo test

For faster development, run the crate or package you touched.

Use focused tests while developing, then run broader tests before publishing changes. Parser, planner, executor, catalog, pgwire, and storage changes can affect each other even when the edit looks local.

SQL fixtures

SQL fixtures live under testing/sql/. They cover areas such as:

Small reproducible bugs should become SQL fixtures where possible.

What a good fixture looks like

A good fixture is small enough to read in one screen:

CREATE TABLE t (id INT PRIMARY KEY, value TEXT);
INSERT INTO t VALUES (1, 'a'), (2, 'b');
SELECT value FROM t WHERE id = 2;

It should make the expected behavior obvious. If the fixture needs a large dataset, generate that dataset deterministically and document the seed or command.

Compatibility suites

The repository includes compatibility-oriented tests for PostgreSQL-facing behavior and graph query behavior. Use these when changing parser, planner, executor, pgwire, or catalog behavior.

Compatibility tests should answer one of three questions:

Do not treat a passing connection test as full compatibility. Real applications usually depend on prepared statements, catalog queries, migrations, transaction recovery, and type mapping.

Benchmarks are not tests

Benchmarks can catch performance regressions, but they do not replace correctness tests. A benchmark result is only useful after the query result is known to be correct.

Before recording a benchmark number, run a correctness query that proves both engines are operating on the same dataset. A faster wrong result is not a performance win.

New test guidance

Areas that deserve extra tests

Add coverage when touching:

These areas are where product features meet infrastructure. Regressions there are more damaging than isolated parser mistakes.