Skip to content

Commit 77dc5bf

Browse files
committed
test: added data and actual export to integration tests.
1 parent 0cd744a commit 77dc5bf

23 files changed

+1157
-163
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@ jobs:
3030
with:
3131
k3s-channel: latest
3232
- name: Run integration test
33-
run: ./scripts/integration-test.sh
33+
run: ./scripts/integration-test.sh --cleanup
34+
env:
35+
USE_EXISTING_CLUSTER: "true"
3436
- name: Debug on failure
3537
if: failure()
3638
run: kubectl get all -n test
3739
- name: Cleanup
3840
if: always()
39-
run: k3d cluster delete pgstac-test || true
41+
run: ./scripts/integration/cleanup.sh --namespace || true

charts/pgstac-geoparquet-exporter/templates/cronjob.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ spec:
9999
- name: AWS_S3_ENDPOINT
100100
value: {{ . | quote }}
101101
{{- end }}
102+
{{- with $.Values.stacApiUrl }}
103+
- name: STAC_API_URL
104+
value: {{ . | quote }}
105+
{{- end }}
102106
{{- with $.Values.storage.region }}
103107
- name: AWS_REGION
104108
value: {{ . | quote }}

charts/pgstac-geoparquet-exporter/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ nameOverride: ""
1010
fullnameOverride: ""
1111
namespaceOverride: ""
1212

13+
# STAC API URL for dynamic link injection (optional)
14+
# When set, enables the stac-geoparquet library to inject links into items
15+
# retrieved from pgSTAC. This is recommended as pgSTAC doesn't store links.
16+
stacApiUrl: ""
17+
1318
# Export job configurations
1419
jobs:
1520
complete:

scripts/README.md

Lines changed: 82 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,96 @@
1-
# Integration Tests
1+
# Scripts
22

3-
Kubernetes integration test using k3d for pgstac-geoparquet-exporter.
3+
## integration-test.sh
44

5-
## Requirements
5+
End-to-end integration test validating the complete export pipeline from pgSTAC to GeoParquet.
66

7-
- Docker
8-
- [k3d](https://k3d.io)
9-
- kubectl
10-
- helm
11-
12-
## Run
7+
### Quick Start
138

149
```bash
1510
./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+
════════════════════════════════════════════════════════════
1635
```
1736

18-
## What it does
37+
### Test Data
1938

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
2541

26-
## Cleanup
42+
### Cleanup
2743

2844
```bash
2945
k3d cluster delete pgstac-test
3046
```
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

Comments
 (0)