Skip to content

Commit 6b57d12

Browse files
authored
Add integration tests to Python Client (#1856)
1 parent 97c9440 commit 6b57d12

File tree

10 files changed

+791
-4
lines changed

10 files changed

+791
-4
lines changed

.github/workflows/python-client.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,25 @@ jobs:
6767
working-directory: client/python
6868
run: poetry install --all-extras
6969

70-
- name: Lint with flake8
70+
- name: Lint
7171
working-directory: client/python
7272
run: |
73-
poetry run flake8 --select=E9,F63,F7,F82 --max-line-length=127 --statistics
73+
make lint
7474
75-
- name: Test with pytest
75+
- name: Generated Client Tests
7676
working-directory: client/python
7777
run: |
7878
export SCRIPT_DIR="non-existing-mock-directory"
79-
poetry run pytest
79+
poetry run pytest test/
80+
81+
- name: Image build
82+
run: |
83+
./gradlew \
84+
:polaris-quarkus-server:assemble \
85+
:polaris-quarkus-server:quarkusAppPartsBuild --rerun \
86+
-Dquarkus.container-image.build=true
87+
88+
- name: Integration Tests
89+
working-directory: client/python
90+
run: |
91+
make test-integration

client/python/.openapi-generator-ignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,8 @@ pyproject.toml
4545
requirements.txt
4646
test-requirements.txt
4747
setup.py
48+
.gitlab-ci.yml
49+
.travis.yml
50+
.github/workflows/python.yml
4851

4952

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
repos:
19+
- repo: https://github.com/pre-commit/pre-commit-hooks
20+
rev: v5.0.0
21+
hooks:
22+
- id: trailing-whitespace
23+
- id: end-of-file-fixer
24+
- id: debug-statements
25+
- repo: https://github.com/astral-sh/ruff-pre-commit
26+
rev: v0.11.13
27+
hooks:
28+
- id: ruff
29+
args: [ --fix, --exit-non-zero-on-fix ]
30+
- id: ruff-format
31+
- repo: https://github.com/pre-commit/mirrors-mypy
32+
rev: v1.16.0
33+
hooks:
34+
- id: mypy
35+
args:
36+
[--disallow-untyped-defs, --ignore-missing-imports, --install-types, --non-interactive]

client/python/Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
regenerate-client:
19+
../templates/regenerate.sh
20+
21+
test-integration:
22+
docker compose -f docker-compose.yml kill
23+
docker compose -f docker-compose.yml rm -f
24+
docker compose -f docker-compose.yml up -d
25+
@echo "Waiting for Polaris HTTP health check to pass..."
26+
@until curl -s -f http://localhost:8182/q/health > /dev/null; do \
27+
sleep 2; \
28+
echo "Still waiting for HTTP 200 from /q/health..."; \
29+
done
30+
@echo "Polaris is healthy. Starting integration tests..."
31+
poetry run pytest integration_tests/ ${PYTEST_ARGS}
32+
33+
34+
lint:
35+
poetry run pre-commit run --files integration_tests/*

client/python/docker-compose.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
services:
21+
polaris:
22+
image: apache/polaris:latest
23+
ports:
24+
- "8181:8181"
25+
- "8182:8182"
26+
environment:
27+
AWS_REGION: us-west-2
28+
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
29+
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
30+
POLARIS_BOOTSTRAP_CREDENTIALS: default-realm,root,s3cr3t
31+
polaris.realm-context.realms: default-realm
32+
quarkus.log.file.enable: "false"
33+
quarkus.otel.sdk.disabled: "true"
34+
polaris.features."DROP_WITH_PURGE_ENABLED": "true"
35+
polaris.features."ALLOW_INSECURE_STORAGE_TYPES": "true"
36+
polaris.features."SUPPORTED_CATALOG_STORAGE_TYPES": "[\"FILE\",\"S3\",\"GCS\",\"AZURE\"]"
37+
polaris.readiness.ignore-severe-issues: "true"
38+
healthcheck:
39+
test: ["CMD", "curl", "http://localhost:8182/q/health"]
40+
interval: 10s
41+
timeout: 10s
42+
retries: 5

0 commit comments

Comments
 (0)