Skip to content

Commit 7d036c7

Browse files
committed
feat(testing): add SQLx/Rust test framework infrastructure
Add comprehensive Rust/SQLx testing infrastructure to replace pgTAP: **Core Framework:** - Create tests/sqlx crate with fluent assertion API - Add selector constants to eliminate magic string literals - Implement query assertion builder for ergonomic test writing **Test Infrastructure:** - Add SQLx migrations for EQL installation and test helpers - Add SQL fixtures for test data seeding - Configure Cargo workspace integration **Tooling & Scripts:** - Add mise tasks for test execution and coverage tracking - Add assertion counting and comparison tools - Add function call tracking for coverage analysis - Add test inventory generator - Add master coverage check script **Configuration:** - Update Docker Compose with track_functions enabled - Add generated migration files to gitignore - Update mise.toml with Rust test tasks **Migration:** - Remove pgTAP testing infrastructure (Dockerfile, tests, scripts) - Add SQL-to-SQLx migration guide documentation - Add assertion count and test inventory docs This infrastructure enables writing Rust tests with SQLx queries instead of pgTAP, providing better IDE support, type safety, and debugging.
1 parent 134b664 commit 7d036c7

36 files changed

+3674
-2229
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,4 +206,7 @@ release/
206206
__pycache__
207207

208208
# dbdev
209-
eql--*.sql
209+
eql--*.sql
210+
211+
# Generated SQLx migration (built from src/, never commit)
212+
tests/sqlx/migrations/001_install_eql.sql

docs/assertion-counts.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Assertion Count Report
2+
3+
Generated: 2025-10-24
4+
5+
# SQL Test Assertions
6+
7+
| File | ASSERT | PERFORM assert_* | SELECT checks | Total |
8+
|------|--------|------------------|---------------|-------|
9+
| `src/blake3/compare_test.sql` | 9 | 0 | 0 | 9 |
10+
| `src/bloom_filter/functions_test.sql` | 0 | 2 | 0 | 2 |
11+
| `src/config/config_test.sql` | 26 | 4 | 11 | 41 |
12+
| `src/encrypted/aggregates_test.sql` | 4 | 0 | 2 | 6 |
13+
| `src/encrypted/constraints_test.sql` | 0 | 6 | 0 | 6 |
14+
| `src/encryptindex/functions_test.sql` | 21 | 1 | 19 | 41 |
15+
| `src/hmac_256/compare_test.sql` | 9 | 0 | 0 | 9 |
16+
| `src/hmac_256/functions_test.sql` | 1 | 2 | 0 | 3 |
17+
| `src/jsonb/functions_test.sql` | 4 | 24 | 0 | 28 |
18+
| `src/operators/->>_test.sql` | 0 | 6 | 0 | 6 |
19+
| `src/operators/->_test.sql` | 2 | 9 | 0 | 11 |
20+
| `src/operators/<=_ore_cllw_u64_8_test.sql` | 0 | 3 | 3 | 6 |
21+
| `src/operators/<=_ore_cllw_var_8_test.sql` | 0 | 3 | 3 | 6 |
22+
| `src/operators/<=_test.sql` | 0 | 8 | 4 | 12 |
23+
| `src/operators/<>_ore_cllw_u64_8_test.sql` | 0 | 3 | 0 | 3 |
24+
| `src/operators/<>_ore_cllw_var_8_test.sql` | 0 | 3 | 0 | 3 |
25+
| `src/operators/<>_ore_test.sql` | 0 | 8 | 0 | 8 |
26+
| `src/operators/<>_test.sql` | 0 | 12 | 2 | 14 |
27+
| `src/operators/<@_test.sql` | 0 | 2 | 0 | 2 |
28+
| `src/operators/<_test.sql` | 0 | 12 | 1 | 13 |
29+
| `src/operators/=_ore_cllw_u64_8_test.sql` | 0 | 3 | 3 | 6 |
30+
| `src/operators/=_ore_cllw_var_8_test.sql` | 0 | 3 | 3 | 6 |
31+
| `src/operators/=_ore_test.sql` | 0 | 8 | 4 | 12 |
32+
| `src/operators/=_test.sql` | 0 | 16 | 12 | 28 |
33+
| `src/operators/>=_test.sql` | 0 | 14 | 10 | 24 |
34+
| `src/operators/>_test.sql` | 0 | 12 | 1 | 13 |
35+
| `src/operators/@>_test.sql` | 4 | 2 | 0 | 6 |
36+
| `src/operators/compare_test.sql` | 63 | 0 | 0 | 63 |
37+
| `src/operators/operator_class_test.sql` | 16 | 1 | 24 | 41 |
38+
| `src/operators/order_by_test.sql` | 0 | 16 | 4 | 20 |
39+
| `src/operators/~~_test.sql` | 0 | 10 | 0 | 10 |
40+
| `src/ore_block_u64_8_256/compare_test.sql` | 9 | 0 | 0 | 9 |
41+
| `src/ore_block_u64_8_256/functions_test.sql` | 1 | 5 | 2 | 8 |
42+
| `src/ore_cllw_u64_8/compare_test.sql` | 9 | 0 | 0 | 9 |
43+
| `src/ore_cllw_var_8/compare_test.sql` | 9 | 0 | 0 | 9 |
44+
| `src/ore_cllw_var_8/functions_test.sql` | 0 | 0 | 0 | 0 |
45+
| `src/ste_vec/functions_test.sql` | 18 | 0 | 0 | 18 |
46+
| `src/version_test.sql` | 0 | 1 | 1 | 2 |
47+
48+
**Total SQL assertions:** 513 across 38 files
49+
50+
# Rust Test Assertions
51+
52+
| File | assert* | expect* | is_err/is_ok | Total |
53+
|------|---------|---------|--------------|-------|
54+
| `rust-tests/tests/add_column_test.rs` | 0 | 0 | 0 | 0 |
55+
| `rust-tests/tests/test_helpers_test.rs` | 0 | 0 | 0 | 0 |
56+
57+
**Total Rust assertions:** 0 across 2 files

0 commit comments

Comments
 (0)