-
Notifications
You must be signed in to change notification settings - Fork 0
170 lines (147 loc) · 4.7 KB
/
Copy pathintegration-tests.yml
File metadata and controls
170 lines (147 loc) · 4.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: Integration Tests
on:
push:
branches: [main]
paths:
- '**.go'
- 'go.mod'
- 'go.sum'
- 'tests/integration/**'
- 'deployments/**'
pull_request:
branches: [main]
paths:
- '**.go'
- 'go.mod'
- 'go.sum'
- 'tests/integration/**'
- 'deployments/**'
workflow_dispatch:
permissions:
contents: read
# Cancel in-progress runs for the same PR/branch
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
pyiceberg-tests:
name: PyIceberg Integration Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: bingsan
POSTGRES_PASSWORD: bingsan
POSTGRES_DB: bingsan
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Start MinIO
run: |
docker run -d --name minio \
-p 9000:9000 -p 9001:9001 \
-e MINIO_ROOT_USER=minioadmin \
-e MINIO_ROOT_PASSWORD=minioadmin \
quay.io/minio/minio:latest server /data --console-address ":9001"
# Wait for MinIO to be healthy
for i in {1..30}; do
if curl -f http://localhost:9000/minio/health/live; then
echo "MinIO is healthy"
break
fi
echo "Waiting for MinIO... ($i/30)"
sleep 2
done
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: tests/integration/requirements.txt
- name: Install Python dependencies
run: pip install -r tests/integration/requirements.txt
- name: Create MinIO bucket
run: |
pip install minio
python -c "
from minio import Minio
client = Minio('localhost:9000', access_key='minioadmin', secret_key='minioadmin', secure=False)
if not client.bucket_exists('warehouse'):
client.make_bucket('warehouse')
print('Bucket created')
"
- name: Build and start Bingsan
run: |
go build -o bingsan ./cmd/iceberg-catalog
./bingsan > bingsan.log 2>&1 &
# Wait for server to start
for i in {1..30}; do
if curl -sf http://localhost:8181/health > /dev/null 2>&1; then
echo "Bingsan is healthy"
break
fi
echo "Waiting for Bingsan... ($i/30)"
sleep 1
if [ $i -eq 30 ]; then
echo "Bingsan failed to start. Logs:"
cat bingsan.log
exit 1
fi
done
env:
ICEBERG_SERVER_HOST: "0.0.0.0"
ICEBERG_SERVER_PORT: "8181"
ICEBERG_DATABASE_HOST: localhost
ICEBERG_DATABASE_PORT: "5432"
ICEBERG_DATABASE_USER: bingsan
ICEBERG_DATABASE_PASSWORD: bingsan
ICEBERG_DATABASE_DATABASE: bingsan
ICEBERG_STORAGE_TYPE: s3
ICEBERG_STORAGE_WAREHOUSE: s3://warehouse/
ICEBERG_STORAGE_S3_ENDPOINT: http://localhost:9000
ICEBERG_STORAGE_S3_ACCESS_KEY_ID: minioadmin
ICEBERG_STORAGE_S3_SECRET_ACCESS_KEY: minioadmin
ICEBERG_STORAGE_S3_USE_PATH_STYLE: "true"
- name: Run PyIceberg tests
run: pytest tests/integration/test_pyiceberg.py -v --tb=short
env:
ICEBERG_CATALOG_URI: http://localhost:8181
ICEBERG_S3_ENDPOINT: http://localhost:9000
- name: Cleanup MinIO
if: always()
run: docker stop minio || true
docker-compose-tests:
name: Docker Compose Integration Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
run: |
docker build -t bingsan:test -f deployments/docker/Dockerfile .
- name: Start test environment
run: |
docker compose -f deployments/docker/docker-compose-test.yml up -d
sleep 30
- name: Health check
run: |
curl -f http://localhost:8181/health || exit 1
- name: Stop test environment
if: always()
run: |
docker compose -f deployments/docker/docker-compose-test.yml down -v