You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@age.apache.org by jg...@apache.org on 2023/02/15 20:50:44 UTC
[age] 04/10: Implement CI test for python driver (#587)
This is an automated email from the ASF dual-hosted git repository.
jgemignani pushed a commit to branch PG11
in repository https://gitbox.apache.org/repos/asf/age.git
commit 42f94e7f36dc084b74ec335536a18173c6fca4cd
Author: Muhammad Taha Naveed <85...@users.noreply.github.com>
AuthorDate: Wed Feb 1 05:37:51 2023 +0500
Implement CI test for python driver (#587)
- This CI workflow will run python driver unit tests and ensure that any
PR/commit that modifies files under age/drivers/python is passing the tests.
- Moved docker-compose.yaml file in age/drivers/golang to age/drivers,because
this is required to instaniate a postgres instance, needed for unit testing.
- Modified host address of connection params to localhost in 'test_age_py.py'
to connect to postgres instance running in docker container.
---
.github/workflows/python-driver.yaml | 45 +++++++++++++++++++++++++++++++++
drivers/{golang => }/docker-compose.yml | 0
drivers/python/test_age_py.py | 4 +--
3 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/python-driver.yaml b/.github/workflows/python-driver.yaml
new file mode 100644
index 0000000..fb6ca3b
--- /dev/null
+++ b/.github/workflows/python-driver.yaml
@@ -0,0 +1,45 @@
+name: Python Driver Tests
+
+on:
+ push:
+ branches: [ "master" ]
+ paths:
+ - 'drivers/python/**'
+
+ pull_request:
+ branches: [ "master" ]
+ paths:
+ - 'drivers/python/**'
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ defaults:
+ run:
+ working-directory: drivers/python
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Run apache/age docker image
+ run: docker-compose up -d
+
+ - name: Set up python
+ uses: actions/setup-python@v4
+ with:
+ python-version: '3.10'
+
+ - name: Install pre-requisites
+ run: |
+ sudo apt-get install python3-dev libpq-dev
+ pip install -r requirements.txt
+
+ - name: Build
+ run: |
+ python setup.py install
+
+ - name: Test
+ run: |
+ python -m unittest -v test_age_py.py
+ python -m unittest -v test_agtypes.py
diff --git a/drivers/golang/docker-compose.yml b/drivers/docker-compose.yml
similarity index 100%
rename from drivers/golang/docker-compose.yml
rename to drivers/docker-compose.yml
diff --git a/drivers/python/test_age_py.py b/drivers/python/test_age_py.py
index 1758989..dfc5fe2 100644
--- a/drivers/python/test_age_py.py
+++ b/drivers/python/test_age_py.py
@@ -18,8 +18,8 @@ import unittest
import decimal
import age
-DSN = "host=172.17.0.2 port=5432 dbname=postgres user=postgres password=agens"
-TEST_HOST = "172.17.0.2"
+DSN = "host=127.0.0.1 port=5432 dbname=postgres user=postgres password=agens"
+TEST_HOST = "127.0.0.1"
TEST_PORT = 5432
TEST_DB = "postgres"
TEST_USER = "postgres"