Skip to content

Conversation

@tobyhede
Copy link
Contributor

@tobyhede tobyhede commented Dec 1, 2025

Remove legacy EQL tests
Adds additional tests to cover gaps in the initial migration

  • add arrow operator metadata field verification
  • add eql_v2.min() and eql_v2.max() aggregate function tests
  • add encrypted column constraint validation tests
  • add selector-based ORE comparison tests
  • add ciphertext extraction and encrypted selector tests
  • add ORDER BY NULL handling and helper function tests

Adds Rust test equivalent for src/operators/->_test.sql lines 106-118.
Verifies that e -> 'selector' returns JSONB with 'i' (index) and 'v' (version) fields.

Part of legacy SQL test migration to Rust/SQLx framework.
- Enhance test comments to clearly explain what behavior is verified
- Add NOTE explaining why raw SQLx is used instead of QueryAssertion
- Replace unwrap() with expect() for clearer error context
Port missing min/max aggregate tests from SQL to Rust/SQLx framework.
Adds 4 new tests covering NULL handling and correct value identification
for both min() and max() functions on encrypted integer columns.

- New fixture: aggregate_minmax_data.sql with encrypted test data
- Tests verify NULL returns for NULL-only queries
- Tests verify correct minimum (plain_int=1) and maximum (plain_int=5) values
Add three Rust/SQLx test cases for eql_v2 encrypted column constraint functions:
- add_encrypted_constraint_prevents_invalid_data: validates constraint blocks invalid JSONB
- remove_encrypted_constraint_allows_invalid_data: validates constraint removal allows invalid data
- version_metadata_validation_on_insert: validates v=2 version field enforcement

These tests verify the constraint management functions work correctly to prevent insertion of malformed eql_v2_encrypted values.
Add 13 Rust/SQLx test cases for selector-based ORE comparisons with index fallback:
- Tests for <, >, <=, >= operators with e->'selector' syntax
- Coverage for ore_cllw_u64_8 index type ($.n numeric selector)
- Coverage for ore_cllw_var_8 index type ($.hello string selector)
- Fallback behavior when requested index type missing

Includes new helper function get_ste_vec_selector_term() to extract selector terms using SQL helper functions, matching the pattern from legacy SQL tests.

These tests verify that ORE comparisons work correctly with selector extraction and gracefully fall back to JSONB literal comparison when the expected index type is not present.
Add test coverage for JSONB path operators with encrypted selectors:
- eql_v2.ciphertext() extraction from arrow operator results
- -> and ->> operators with eql_v2_encrypted selectors

Tests verify ciphertext extraction functionality and encrypted selector
handling across both single-row and multi-row scenarios.
Add test coverage for ORDER BY edge cases and helper function:
- NULLS FIRST/LAST behavior in ASC and DESC ordering
- eql_v2.order_by() helper function with filtered result sets

Tests verify correct NULL positioning in ordered results and proper
functioning of the order_by helper across different sort directions.
Add DROP TABLE IF EXISTS before CREATE TABLE to allow fixture
to be executed multiple times without 'relation already exists' error.
Add secondary sort by id to ensure deterministic ordering among NULL rows.
SQL standard only guarantees NULLs precede/follow non-NULLs, not ordering
among equal sort keys. Without tie-breaker, tests could flake depending on
planner behavior.
Remove 38 inline SQL test files from src/ directory.
These tests have been migrated to the SQLx Rust test framework
in tests/sqlx/.
Remove tasks/test/legacy.sh - no longer needed after
removal of inline SQL tests.
Remove legacy SQL test invocation from main test runner.
Tests now run in 2 phases:
1. SQLx Rust lint checks
2. SQLx Rust tests
Remove files that tracked SQL-to-SQLx test migration:
- test-migration-guide.md
- test-inventory.md
- assertion-counts.md

Migration is complete - these files are no longer needed.
- Update file structure description to reference tests/sqlx/
- Simplify testing section to focus on SQLx framework
- Remove outdated mermaid workflow diagram
- Fix formatting of IMPORTANT block
Update testing documentation to reflect removal of
legacy SQL tests and use of SQLx Rust framework only.
@tobyhede tobyhede changed the title test: add arrow operator metadata field verification Remove legacy EQL tests src/**/*_test.sql Dec 1, 2025
The aggregate tests (count, max, min) were incorrectly testing
the plain `id` column instead of the encrypted `e` column:

- count_aggregate_on_encrypted_column: COUNT(*) → COUNT(e)
- max_aggregate_on_encrypted_column: MAX(id) → eql_v2.max(e)
- min_aggregate_on_encrypted_column: MIN(id) → eql_v2.min(e)

These tests now properly verify that aggregate functions work
on encrypted data, not just plain integers.
Copy link
Contributor

@auxesis auxesis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the cleanup @tobyhede.

I have added suggestions for tidying up after the LLM. I will batch commit those, then this PR should be good to merge.

Copy link
Contributor

@auxesis auxesis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the cleanup @tobyhede.

I have added suggestions for tidying up after the LLM. I will batch commit those, then this PR should be good to merge.

Claude chattily records the minutiae of transforming text from one file to
another. That's not helpful to future maintainers, and will confuse newcomers
to the code base.
@auxesis auxesis force-pushed the remove-legacy-tests branch from 7afbabc to 57d7635 Compare December 1, 2025 14:41
@auxesis auxesis merged commit 4bef1b0 into main Dec 2, 2025
4 checks passed
@auxesis auxesis deleted the remove-legacy-tests branch December 2, 2025 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants