Files
poimen-memory/k8s/test/integration-test-job.yaml
T
rock ce6c93d3b5
CI / CI (pull_request) Successful in 15m38s
refactor: focus on K8s Job integration testing, remove random scripts
Remove unfocused shell scripts - rely on existing integration tests instead:
  - ✓ tests/it_unified_query_4_6.rs (query tests)
  - ✓ tests/it_temporal_filtering_4_2_fixed.rs (temporal query)
  - ✓ tests/it_phase3_phase4.rs (ingest tests)
  - ✓ tests/it_authorized_pipeline.rs (auth + ingest)

Removed:
  - apply_migrations.sh (use migrations/ runner script)
  - collect_prod_logs.sh (k8s logs available)
  - run_production_test.sh (use cargo test)
  - test_prod_ingest_real.sh (existing it_phase3_phase4.rs)
  - tests/integration_ingest_with_gw.rs (duplicate)
  - tests/unit_ingest_logging.rs (duplicate)

Keep:
  - migrations/run_migrations.sh (K8s Job requirement)
  - k8s/test/integration-test-job.yaml (CI/CD integration)
  - .gitea/workflows/integration-test.yaml (CI orchestration)
  - k8s/test/db-credentials.enc.yaml (SOPS encrypted secrets)

Proper approach: K8s Job runs existing integration tests via 'cargo test'
                 ArgoCD+KSOPS decrypts secrets
                 Tests execute against new image SHA
2026-09-14 22:55:58 +09:00

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