Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[KYUUBI #6281][PY] Initialize github action for python unit testing
# 🔍 Description ## Issue References 🔗 This pull request fixes #6281 ## Describe Your Solution 🔧 The change initialize a CI job to run unit testing on python client, including: - Set up Github Action based on docker-compose - Update test cases and test succeeded for dialect `presto` and `trino` - Temporary disabled hive related test due to test cases are not valid, not about connection - Update dev dependencies to support python 3.10 - Speed up testing with `pytest-xdist` plugin ## Types of changes 🔖 - [ ] Bugfix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Test Plan 🧪 #### Behavior Without This Pull Request ⚰️ Not able to ran unit test in local and on CI #### Behavior With This Pull Request 🎉 Able to run and partially cover a couple of test cases #### Related Unit Tests No ## Additional notes Next action is about fixing failing test cases or considering skipping some of them if necessary --- # Checklist 📝 - [ ] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html) **Be nice. Be informative.** Closes #6343 from sudohainguyen/ci/init. Closes #6281 682e575 [Harry] Remove xdist out of scope dc42ca1 [Harry] Pin pytest packages version 469f1d9 [Harry] Pin ubuntu version 00cef47 [Harry] Use v4 checkout action 96ef831 [Harry] Remove unnecessary steps 732344a [Harry] Add step to tear down containers 1e2c248 [Harry] Resolved trino and presto test 5b33e39 [Harry] Make tests runnable 1be033b [Harry] Remove randome flag which causes failed test run 2bc6dc0 [Harry] Switch action setup provider to docker ea2a763 [Harry] Initialize github action for python unit testing Authored-by: Harry <quanghai.ng1512@gmail.com> Signed-off-by: Cheng Pan <chengpan@apache.org>
- Loading branch information
1 parent
28d8c8e
commit 9075fbb
Showing
26 changed files
with
210 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
name: Python Client | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- branch-* | ||
pull_request: | ||
branches: | ||
- master | ||
- branch-* | ||
|
||
concurrency: | ||
group: python-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
unit-test: | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10"] | ||
env: | ||
PYTHONHASHSEED: random | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Start Testing Containers | ||
run: | | ||
cd python/docker/ | ||
docker compose up -d --wait | ||
docker compose exec hive-server /opt/hive/scripts/make_test_tables.sh | ||
- name: Install dependencies | ||
run: | | ||
cd python | ||
./scripts/install-deps.sh | ||
- name: Run tests | ||
run: | | ||
cd python | ||
pytest -v | ||
- name: Tear down Containers | ||
run: | | ||
cd python/docker/ | ||
docker compose down --volumes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
cover/ | ||
.coverage | ||
/dist/ | ||
/build/ | ||
.DS_Store | ||
*.egg | ||
/env/ | ||
/htmlcov/ | ||
.idea/ | ||
.project | ||
*.pyc | ||
.pydevproject | ||
/*.egg-info/ | ||
.settings | ||
.cache/ | ||
*.iml | ||
/scripts/.thrift_gen | ||
venv/ | ||
.envrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
connector.name=hive-hadoop2 | ||
hive.metastore.uri=thrift://hive-metastore:9083 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
connector.name=hive-hadoop2 | ||
hive.metastore.uri=thrift://hive-metastore:9083 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
version: "3" | ||
|
||
services: | ||
namenode: | ||
image: bde2020/hadoop-namenode:2.0.0-hadoop2.7.4-java8 | ||
volumes: | ||
- namenode:/hadoop/dfs/name | ||
environment: | ||
- CLUSTER_NAME=test | ||
env_file: | ||
- hadoop-hive.env | ||
ports: | ||
- "50070:50070" | ||
datanode: | ||
image: bde2020/hadoop-datanode:2.0.0-hadoop2.7.4-java8 | ||
volumes: | ||
- datanode:/hadoop/dfs/data | ||
env_file: | ||
- hadoop-hive.env | ||
environment: | ||
SERVICE_PRECONDITION: "namenode:50070" | ||
ports: | ||
- "50075:50075" | ||
hive-server: | ||
image: bde2020/hive:2.3.2-postgresql-metastore | ||
env_file: | ||
- hadoop-hive.env | ||
volumes: | ||
- ../scripts:/opt/hive/scripts | ||
environment: | ||
HIVE_CORE_CONF_javax_jdo_option_ConnectionURL: "jdbc:postgresql://hive-metastore/metastore" | ||
SERVICE_PRECONDITION: "hive-metastore:9083" | ||
ports: | ||
- "10000:10000" | ||
hive-metastore: | ||
image: bde2020/hive:2.3.2-postgresql-metastore | ||
env_file: | ||
- hadoop-hive.env | ||
command: /opt/hive/bin/hive --service metastore | ||
environment: | ||
SERVICE_PRECONDITION: "namenode:50070 datanode:50075 hive-metastore-postgresql:5432" | ||
ports: | ||
- "9083:9083" | ||
hive-metastore-postgresql: | ||
image: bde2020/hive-metastore-postgresql:2.3.0 | ||
presto-coordinator: | ||
image: shawnzhu/prestodb:0.181 | ||
ports: | ||
- "8080:8080" | ||
volumes: | ||
- ./conf/presto/:/etc/presto | ||
trino: | ||
image: trinodb/trino:351 | ||
ports: | ||
- "18080:18080" | ||
volumes: | ||
- ./conf/trino:/etc/trino | ||
|
||
volumes: | ||
namenode: | ||
datanode: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
HIVE_SITE_CONF_javax_jdo_option_ConnectionURL=jdbc:postgresql://hive-metastore-postgresql/metastore | ||
HIVE_SITE_CONF_javax_jdo_option_ConnectionDriverName=org.postgresql.Driver | ||
HIVE_SITE_CONF_javax_jdo_option_ConnectionUserName=hive | ||
HIVE_SITE_CONF_javax_jdo_option_ConnectionPassword=hive | ||
HIVE_SITE_CONF_datanucleus_autoCreateSchema=false | ||
HIVE_SITE_CONF_hive_metastore_uris=thrift://hive-metastore:9083 | ||
HDFS_CONF_dfs_namenode_datanode_registration_ip___hostname___check=false | ||
|
||
CORE_CONF_fs_defaultFS=hdfs://namenode:8020 | ||
CORE_CONF_hadoop_http_staticuser_user=root | ||
CORE_CONF_hadoop_proxyuser_hue_hosts=* | ||
CORE_CONF_hadoop_proxyuser_hue_groups=* | ||
|
||
HDFS_CONF_dfs_webhdfs_enabled=true | ||
HDFS_CONF_dfs_permissions_enabled=false | ||
|
||
YARN_CONF_yarn_log___aggregation___enable=true | ||
YARN_CONF_yarn_resourcemanager_recovery_enabled=true | ||
YARN_CONF_yarn_resourcemanager_store_class=org.apache.hadoop.yarn.server.resourcemanager.recovery.FileSystemRMStateStore | ||
YARN_CONF_yarn_resourcemanager_fs_state___store_uri=/rmstate | ||
YARN_CONF_yarn_nodemanager_remote___app___log___dir=/app-logs | ||
YARN_CONF_yarn_log_server_url=http://historyserver:8188/applicationhistory/logs/ | ||
YARN_CONF_yarn_timeline___service_enabled=true | ||
YARN_CONF_yarn_timeline___service_generic___application___history_enabled=true | ||
YARN_CONF_yarn_resourcemanager_system___metrics___publisher_enabled=true | ||
YARN_CONF_yarn_resourcemanager_hostname=resourcemanager | ||
YARN_CONF_yarn_timeline___service_hostname=historyserver | ||
YARN_CONF_yarn_resourcemanager_address=resourcemanager:8032 | ||
YARN_CONF_yarn_resourcemanager_scheduler_address=resourcemanager:8030 | ||
YARN_CONF_yarn_resourcemanager_resource__tracker_address=resourcemanager:8031 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash -eux | ||
|
||
source /etc/lsb-release | ||
|
||
sudo apt-get -q update | ||
sudo apt-get -q install -y g++ libsasl2-dev libkrb5-dev | ||
|
||
pip install --upgrade pip | ||
pip install -r dev_requirements.txt | ||
pip install -e . |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.