|
1 | | -# Integration Tests |
| 1 | +# Scripts |
2 | 2 |
|
3 | | -Kubernetes integration test using k3d for pgstac-geoparquet-exporter. |
| 3 | +## integration-test.sh |
4 | 4 |
|
5 | | -## Requirements |
| 5 | +End-to-end integration test validating the complete export pipeline from pgSTAC to GeoParquet. |
6 | 6 |
|
7 | | -- Docker |
8 | | -- [k3d](https://k3d.io) |
9 | | -- kubectl |
10 | | -- helm |
11 | | - |
12 | | -## Run |
| 7 | +### Quick Start |
13 | 8 |
|
14 | 9 | ```bash |
15 | 10 | ./scripts/integration-test.sh |
| 11 | + |
| 12 | +# Optional: customize cluster/namespace |
| 13 | +CLUSTER_NAME=my-cluster NAMESPACE=my-ns ./scripts/integration-test.sh |
| 14 | +``` |
| 15 | + |
| 16 | +**Requirements**: kubectl, helm, python3 (pip). k3d auto-installed if no cluster exists. |
| 17 | + |
| 18 | +### What It Tests |
| 19 | + |
| 20 | +1. **Infrastructure**: k3d cluster, PostgreSQL Operator, pgSTAC, MinIO, Helm chart |
| 21 | +2. **Data Loading**: Creates test collection + 3 STAC items via pypgstac |
| 22 | +3. **Export Jobs**: Triggers complete export (and incremental - expected to fail) |
| 23 | +4. **Validation**: Reads GeoParquet files with PyArrow, validates schema and row count |
| 24 | + |
| 25 | +### Expected Output |
| 26 | + |
| 27 | +``` |
| 28 | +✓ ALL TESTS PASSED SUCCESSFULLY |
| 29 | +════════════════════════════════════════════════════════════ |
| 30 | + ✓ CronJobs created: 2 |
| 31 | + ✓ STAC items loaded: 3 |
| 32 | + ✓ Complete export: SUCCESS |
| 33 | + ✓ Geoparquet validation: PASSED |
| 34 | +════════════════════════════════════════════════════════════ |
16 | 35 | ``` |
17 | 36 |
|
18 | | -## What it does |
| 37 | +### Test Data |
19 | 38 |
|
20 | | -1. Creates k3d cluster |
21 | | -2. Installs PostgreSQL Operator + pgSTAC database |
22 | | -3. Deploys MinIO (S3) |
23 | | -4. Installs helm chart |
24 | | -5. Verifies CronJobs are created |
| 39 | +- **Collection**: `test-collection` (STAC 1.0.0, global extent, 2020-2023) |
| 40 | +- **Items**: 3 items with polygon geometries, datetime properties, and assets |
25 | 41 |
|
26 | | -## Cleanup |
| 42 | +### Cleanup |
27 | 43 |
|
28 | 44 | ```bash |
29 | 45 | k3d cluster delete pgstac-test |
30 | 46 | ``` |
| 47 | + |
| 48 | +### Troubleshooting |
| 49 | + |
| 50 | +**Data loading fails** |
| 51 | +```bash |
| 52 | +kubectl get pods -n test -l postgres-operator.crunchydata.com/cluster=pgstac |
| 53 | +``` |
| 54 | + |
| 55 | +**Export job fails** |
| 56 | +```bash |
| 57 | +kubectl logs -n test job/test-complete-export |
| 58 | +``` |
| 59 | + |
| 60 | +**Validation fails** |
| 61 | +```bash |
| 62 | +# Check MinIO |
| 63 | +kubectl get pods -n test -l app=minio |
| 64 | + |
| 65 | +# Access MinIO UI |
| 66 | +kubectl port-forward -n test svc/minio 9000:9000 |
| 67 | +# Open http://localhost:9000 (minioadmin/minioadmin) |
| 68 | +``` |
| 69 | + |
| 70 | +**Python deps fail**: Test skips validation and reports partial success |
| 71 | + |
| 72 | +### Manual Inspection |
| 73 | + |
| 74 | +Keep cluster running and inspect: |
| 75 | + |
| 76 | +```bash |
| 77 | +# View resources |
| 78 | +kubectl get all -n test |
| 79 | + |
| 80 | +# Trigger manual export |
| 81 | +kubectl create job manual-$(date +%s) \ |
| 82 | + --from=cronjob/exporter-pgstac-geoparquet-exporter-complete -n test |
| 83 | + |
| 84 | +# View logs |
| 85 | +kubectl logs -n test -l app=geoparquet-export --tail=100 |
| 86 | +``` |
| 87 | + |
| 88 | +### CI/CD |
| 89 | + |
| 90 | +```yaml |
| 91 | +- name: Integration Tests |
| 92 | + run: ./scripts/integration-test.sh |
| 93 | + timeout-minutes: 15 |
| 94 | +``` |
| 95 | +
|
| 96 | +**Runtime**: ~5-8 minutes |
0 commit comments