From 5ac85eaadda8e88968c252353133ecae1c4fc0eb Mon Sep 17 00:00:00 2001 From: Mostafa Abdelraouf Date: Tue, 2 Aug 2022 17:52:22 -0500 Subject: [PATCH] Fix Python tests and remove CircleCI-specific path (#106) * Remove CircleCI-specific path in tests * ..? * Fix testsP * Fix python test * remove pip * Maybe fail? * return code? * no & * Fix tests --- .circleci/config.yml | 2 +- .circleci/run_tests.sh | 18 +++++++++--------- tests/python/tests.py | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e9bb12f..45ded26 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,7 +32,7 @@ jobs: command: "cargo fmt --check" - run: name: "Install dependencies" - command: "sudo apt-get update && sudo apt-get install -y psmisc postgresql-contrib-12 postgresql-client-12 ruby ruby-dev libpq-dev python" + command: "sudo apt-get update && sudo apt-get install -y psmisc postgresql-contrib-12 postgresql-client-12 ruby ruby-dev libpq-dev python3 python3-pip" - run: name: "Build" command: "cargo build" diff --git a/.circleci/run_tests.sh b/.circleci/run_tests.sh index a6fb790..138dbec 100644 --- a/.circleci/run_tests.sh +++ b/.circleci/run_tests.sh @@ -66,19 +66,19 @@ psql -U sharding_user -e -h 127.0.0.1 -p 6432 -f tests/sharding/query_routing_te # # ActiveRecord tests # -cd tests/ruby && \ - sudo gem install bundler && \ - bundle install && \ - ruby tests.rb -cd /home/circleci/project +cd tests/ruby +sudo gem install bundler +bundle install +ruby tests.rb +cd ../.. # # Python tests # -cd tests/python && \ - pip install -r requirements.txt && \ - python tests.py -cd /home/circleci/project +cd tests/python +pip3 install -r requirements.txt +python3 tests.py +cd ../.. # Admin tests diff --git a/tests/python/tests.py b/tests/python/tests.py index 06d27dc..15e3822 100644 --- a/tests/python/tests.py +++ b/tests/python/tests.py @@ -10,7 +10,7 @@ def test_normal_db_access(): def test_admin_db_access(): - conn = psycopg2.connect("postgres://user:pass@127.0.0.1:6432/pgcat") + conn = psycopg2.connect("postgres://admin_user:admin_pass@127.0.0.1:6432/pgcat") conn.autocommit = True # BEGIN/COMMIT is not supported by admin db cur = conn.cursor()