hadith-ingestion/hadith-ingestion/test-hadithapi-k8s.sh

44 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# test-hadithapi-k8s.sh
set -e
echo "=== Kubernetes HadithAPI Integration Test ==="
# 1. Create secrets
echo "Creating secrets..."
./create-secrets.sh
# 2. Build and load image (if using local cluster)
echo "Building Docker image..."
docker build -t hadith-ingestion:latest .
# If using kind/minikube, load image
# kind load docker-image hadith-ingestion:latest
# 3. Submit test workflow (10 hadiths)
echo "Submitting test workflow..."
argo submit -n ml argo/workflows/ingest-hadithapi.yaml \
--parameter book-slug=sahih-bukhari \
--parameter limit=10 \
--wait \
--log
# 4. Check workflow status
echo -e "\nChecking workflow status..."
argo list -n argo
# 5. Verify data in database
echo -e "\nVerifying data..."
kubectl -n db exec -it postgres-0 -- psql -U hadith_ingest -d hadith_db -c "
SELECT
c.name_english,
COUNT(h.id) as hadith_count,
MAX(h.created_at) as last_ingestion
FROM collections c
LEFT JOIN hadiths h ON c.id = h.collection_id
WHERE c.abbreviation = 'bukhari'
GROUP BY c.name_english;
"
echo -e "\n=== Test Complete ==="