feat: Add comprehensive test suite and cleanup step
- Split validation into 4 granular CI steps (Config, Timescale, Vector, Hybrid) - Added cleanup step for Docker images in CI - Created SQL test scripts in tests/ for robustness
This commit is contained in:
27
tests/test-3-vector.sql
Normal file
27
tests/test-3-vector.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- Test 3: VectorChord / pgvector
|
||||
\set ON_ERROR_STOP on
|
||||
|
||||
DROP TABLE IF EXISTS items;
|
||||
|
||||
CREATE TABLE items (
|
||||
id bigserial PRIMARY KEY,
|
||||
embedding vector(3)
|
||||
);
|
||||
|
||||
INSERT INTO items (embedding) VALUES ('[1,2,3]'), ('[4,5,6]'), ('[1.1, 2.1, 3.1]');
|
||||
|
||||
-- Create VectorChord Index
|
||||
CREATE INDEX ON items USING vchordrq (embedding vector_l2_ops);
|
||||
|
||||
-- Search
|
||||
DO $$
|
||||
DECLARE
|
||||
closest_id int;
|
||||
BEGIN
|
||||
SELECT id INTO closest_id FROM items ORDER BY embedding <-> '[1,2,3]' LIMIT 1;
|
||||
IF closest_id != 1 THEN
|
||||
RAISE EXCEPTION 'Vector search failed. Expected ID 1, got %', closest_id;
|
||||
END IF;
|
||||
RAISE NOTICE 'Vector Check: OK';
|
||||
END
|
||||
$$;
|
||||
Reference in New Issue
Block a user