172 lines
4.8 KiB
YAML
172 lines
4.8 KiB
YAML
---
|
|||
# Integration Test Job - Runs existing Rust integration tests in K8s
|
|||
#
|
|||
# Two-stage execution:
|
|||
|
|
# 1. migrate: Apply database migrations
|
||
|
|
# 2. test: Run existing integration tests (cargo test)
|
||
#
|
|||
# Tests executed:
|
|||
|
|
# - it_phase3_phase4: Ingest + persistence tests
|
||
|
|
# - it_unified_query_4_6: Query endpoint tests
|
||
|
|
# - it_temporal_filtering_4_2_fixed: Temporal query tests
|
||
|
|
# - mem_ingest: Extraction pipeline tests
|
||
|
|
# - mem_cli::query: Query handler tests
|
||
|
|||
|
|
apiVersion: batch/v1
|
||
|
|
kind: Job
|
||
|
|
metadata:
|
||
|
|
name: poimen-memory-integration-test
|
||
|
|
namespace: poimen
|
||
|
|
labels:
|
||
|
|
app: poimen-memory
|
||
|
|
test: integration
|
||
|
|
component: ci-cd
|
||
|
|
spec:
|
||
|
|
backoffLimit: 0
|
||
|
|
activeDeadlineSeconds: 600
|
||
ttlSecondsAfterFinished: 3600
|
|||
|
|||
|
|
template:
|
||
|
|
metadata:
|
||
|
|
labels:
|
||
|
|
app: poimen-memory
|
||
|
|
test: integration
|
||
|
|
spec:
|
||
|
|
serviceAccountName: memory-app
|
||
|
|
restartPolicy: Never
|
||
|
|
|
||
|
|
containers:
|
||
# Stage 1: Apply migrations
|
|||
- name: migrate
|
|||
|
|
image: forgejo.riotpiao.com/riotpiao-poimen/poimen-memory:IMAGE_SHA
|
||
|
|
imagePullPolicy: IfNotPresent
|
||
|
|
|
||
|
|
command:
|
||
|
|
- /bin/bash
|
||
|
|
- -c
|
||
|
|
- |
|
||
|
|
set -e
|
||
|
|
|
||
echo "=========================================="
|
|||
|
|
echo "Applying Database Migrations"
|
||
|
|
echo "=========================================="
|
||
|
|
echo ""
|
||
|
|||
# Run migrations script
|
|||
|
|
/app/migrations/run_migrations.sh
|
||
|
|||
|
|
echo ""
|
||
|
|
echo "✓ Migrations complete"
|
||
|
|
|
||
|
|
env:
|
||
|
|
- name: DB_HOST
|
||
|
|
value: "memory-db-rw.poimen.svc.cluster.local"
|
||
|
|
- name: DB_PORT
|
||
|
|
value: "5432"
|
||
|
|
- name: DB_NAME
|
||
|
|
value: "memory"
|
||
|
|
- name: DB_USER
|
||
|
|
value: "app"
|
||
|
|
- name: DB_PASSWORD
|
||
|
|
valueFrom:
|
||
|
|
secretKeyRef:
|
||
|
|
name: memory-db-app
|
||
|
|
key: password
|
||
|
|
|
||
|
|
resources:
|
||
|
|
requests:
|
||
|
|
memory: "256Mi"
|
||
|
|
cpu: "100m"
|
||
|
|
limits:
|
||
|
|
memory: "512Mi"
|
||
|
|
cpu: "500m"
|
||
|
|
|
||
# Stage 2: Run integration tests
|
|||
- name: test
|
|||
|
|
image: forgejo.riotpiao.com/riotpiao-poimen/poimen-memory:IMAGE_SHA
|
||
|
|
imagePullPolicy: IfNotPresent
|
||
|
|
|
||
|
|
command:
|
||
|
|
- /bin/bash
|
||
|
|
- -c
|
||
|
|
- |
|
||
|
|
set -e
|
||
|
|
|
||
|
|
echo "=========================================="
|
||
echo "Running Integration Tests"
|
|||
echo "=========================================="
|
|||
|
|
echo ""
|
||
|
|
|
||
# Run existing integration tests
|
|||
|
|
echo "Test Suite 1: Ingest + Persistence (it_phase3_phase4)"
|
||
|
|
cargo test --test it_phase3_phase4 --lib 2>&1 | tail -50 || TEST_FAILED=1
|
||
|
|||
|
|
echo ""
|
||
echo "Test Suite 2: Unified Query (it_unified_query_4_6)"
|
|||
|
|
cargo test --test it_unified_query_4_6 --lib 2>&1 | tail -50 || TEST_FAILED=1
|
||
|
|
|
||
echo ""
|
|||
echo "Test Suite 3: Temporal Filtering (it_temporal_filtering_4_2_fixed)"
|
|||
|
|
cargo test --test it_temporal_filtering_4_2_fixed --lib 2>&1 | tail -50 || TEST_FAILED=1
|
||
|
|||
echo ""
|
|||
|
|
echo "Test Suite 4: Ingest Pipeline Unit Tests"
|
||
|
|
cargo test --lib mem_ingest 2>&1 | tail -100 || TEST_FAILED=1
|
||
|
|||
echo ""
|
|||
|
|
echo "Test Suite 5: Query Handler Tests"
|
||
|
|
cargo test --lib mem_cli::query 2>&1 | tail -100 || TEST_FAILED=1
|
||
|
|||
echo ""
|
|||
|
|
echo "=========================================="
|
||
|
|
echo "Integration Tests Complete"
|
||
|
|
echo "=========================================="
|
||
|
|
|
||
|
|
if [ -n "$TEST_FAILED" ]; then
|
||
|
|
echo "✗ Some tests failed"
|
||
exit 1
|
|||
|
|
fi
|
||
|
|
|
||
echo "✓ All tests passed"
|
|||
|
|||
|
|
env:
|
||
|
|
- name: DATABASE_URL
|
||
|
|
value: "postgresql://[email protected]:5432/memory"
|
||
|
|
- name: RUST_LOG
|
||
value: "info,mem_cli=debug,mem_ingest=debug,mem_store=debug"
|
|||
- name: MEM_AUTH_MODE
|
|||
|
|
value: "none"
|
||
- name: SQLX_OFFLINE
|
|||
|
|
value: "true"
|
||
- name: PGPASSWORD
|
|||
|
|
valueFrom:
|
||
|
|
secretKeyRef:
|
||
|
|
name: memory-db-app
|
||
|
|
key: password
|
||
|
|
|
||
|
|
resources:
|
||
|
|
requests:
|
||
|
|
memory: "1Gi"
|
||
cpu: "500m"
|
|||
|
|
limits:
|
||
|
|
memory: "2Gi"
|
||
|
|
cpu: "2000m"
|
||
|
|||
|
|
livenessProbe:
|
||
|
|
exec:
|
||
|
|
command:
|
||
|
|
- /bin/sh
|
||
|
|
- -c
|
||
- test -f /proc/self/status
|
|||
|
|
initialDelaySeconds: 10
|
||
|
|
periodSeconds: 30
|
||
|
|||
|
|
---
|
||
|
|
apiVersion: v1
|
||
|
|
kind: ServiceAccount
|
||
|
|
metadata:
|
||
|
|
name: memory-app
|
||
|
|
namespace: poimen
|
||
|
|
labels:
|
||
|
|
app: poimen-memory
|