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:
@@ -51,30 +51,23 @@ jobs:
|
||||
sleep 2
|
||||
done
|
||||
|
||||
- name: 🧪 Test image - Verify extensions
|
||||
- name: ⚙️ Setup Tests
|
||||
run: |
|
||||
# Wait a bit more for init scripts to complete
|
||||
sleep 5
|
||||
|
||||
# Check extensions are installed
|
||||
RESULT=$(docker exec test-pg${{ matrix.pg_version }} psql -U postgres -t -c \
|
||||
"SELECT count(*) FROM pg_extension WHERE extname IN ('timescaledb', 'vector', 'vchord');")
|
||||
|
||||
EXTENSIONS=$(echo $RESULT | tr -d ' ')
|
||||
echo "Found $EXTENSIONS extensions"
|
||||
|
||||
if [ "$EXTENSIONS" -eq "3" ]; then
|
||||
echo "✅ All 3 extensions are installed!"
|
||||
else
|
||||
echo "❌ Expected 3 extensions, found $EXTENSIONS"
|
||||
docker exec test-pg${{ matrix.pg_version }} psql -U postgres -c \
|
||||
"SELECT extname, extversion FROM pg_extension;"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Show extension versions
|
||||
docker exec test-pg${{ matrix.pg_version }} psql -U postgres -c \
|
||||
"SELECT extname, extversion FROM pg_extension WHERE extname IN ('timescaledb', 'vector', 'vchord');"
|
||||
# Wait for valid startup
|
||||
sleep 10
|
||||
docker cp tests/ test-pg${{ matrix.pg_version }}:/tmp/tests/
|
||||
|
||||
- name: 🧪 Test 1: Configuration
|
||||
run: docker exec test-pg${{ matrix.pg_version }} psql -U postgres -f /tmp/tests/test-1-config.sql
|
||||
|
||||
- name: 🧪 Test 2: TimescaleDB
|
||||
run: docker exec test-pg${{ matrix.pg_version }} psql -U postgres -f /tmp/tests/test-2-timescale.sql
|
||||
|
||||
- name: 🧪 Test 3: VectorChord
|
||||
run: docker exec test-pg${{ matrix.pg_version }} psql -U postgres -f /tmp/tests/test-3-vector.sql
|
||||
|
||||
- name: 🧪 Test 4: Hybrid Scenarios
|
||||
run: docker exec test-pg${{ matrix.pg_version }} psql -U postgres -f /tmp/tests/test-4-hybrid.sql
|
||||
|
||||
- name: 🧹 Cleanup test container
|
||||
if: always()
|
||||
@@ -101,4 +94,10 @@ jobs:
|
||||
tags: |
|
||||
gitea.killinger.fr/maxime.killinger/postgres-ts-vectors:latest
|
||||
|
||||
- name: 🧹 Cleanup Docker images
|
||||
if: always()
|
||||
run: |
|
||||
docker rmi postgres-ts-vectors:pg${{ matrix.pg_version }}-test || true
|
||||
docker image prune -f
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user