Skip to content

Commit

Permalink
test: use the v2.5.0 python driver
Browse files Browse the repository at this point in the history
Signed-off-by: Gabor Boros <gabor.brs@gmail.com>
  • Loading branch information
gabor-boros committed Jul 4, 2022
1 parent 70654fa commit 779b734
Show file tree
Hide file tree
Showing 15 changed files with 270 additions and 251 deletions.
15 changes: 8 additions & 7 deletions .github/actions/driver-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@ inputs:
commit_hash:
description: The commit hash to use at checkout.
required: false
# TODO: This commit is pointing after driver extraction, hence it should be the baseline.
# When all tests are passing using this commit hash, update the hash to the latest and
# fix the newly raised issues.
default_python_driver_commit_hash:
description: The commit hash to use at checkout for the default Python driver.
default: f0bf3b7e5279d23b72ffc8d8d3ae7e26dd5384e4
default: abbefd7e06b1e1449804e5a9df2af87b368cbed4
required: false
install_command:
description: The test runner command to execute.
Expand Down Expand Up @@ -50,6 +47,10 @@ inputs:
runs:
using: composite
steps:
- uses: actions/setup-python@v3
with:
python-version: '3.8'

- name: download ${{ inputs.driver_name }} driver
if: ${{ inputs.driver_name != 'python' }}
shell: bash
Expand All @@ -68,9 +69,9 @@ runs:
git clone https://github.com/rethinkdb/rethinkdb-python /tmp/python-driver
cd /tmp/python-driver
git checkout ${{ inputs.default_python_driver_commit_hash }}
sudo apt install -y rsync
pip install -r requirements.txt
make prepare
pip install poetry
poetry install
make ql2.proto
cd -
- name: setup ${{ inputs.driver_name }} driver
Expand Down
4 changes: 0 additions & 4 deletions .github/actions/tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ inputs:
runs:
using: composite
steps:
- uses: actions/setup-python@v3
with:
python-version: '2.7'

- name: install prerequisites
shell: bash
run: |
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ jobs:
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: '2.7'

- name: cpplint
uses: ./.github/actions/tests
with:
Expand All @@ -38,7 +42,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: '2.7'
python-version: '3.8'

- name: apt install
run: |
Expand Down Expand Up @@ -81,6 +85,10 @@ jobs:
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: '2.7'

- name: unit tests
uses: ./.github/actions/tests
with:
Expand Down Expand Up @@ -109,6 +117,10 @@ jobs:
needs: unit-tests
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: '3.8'

- name: integration tests
uses: ./.github/actions/driver-tests
with:
Expand Down Expand Up @@ -137,6 +149,10 @@ jobs:
needs: unit-tests
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: '3.8'

- name: long running tests
uses: ./.github/actions/driver-tests
with:
Expand Down Expand Up @@ -177,7 +193,7 @@ jobs:
with:
driver_name: python
driver_dist_dir: /tmp/python-driver/rethinkdb
interpreter: py2.7
interpreter: py3.8
test_target: polyglot

- name: compress test artifacts for upload
Expand Down
3 changes: 2 additions & 1 deletion test/common/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,8 @@ def parse(self, args, groups, group=None):
return filter

def combine(self, type, other):
for name in set(self.tree.keys() + other.tree.keys()):
combined_keys = set(list(self.tree.keys()) + list(other.tree.keys()))
for name in combined_keys:
self.zoom(name, create=True).combine(type, other.zoom(name))
if other.default == self.INCLUDE:
self.default = type
Expand Down
11 changes: 5 additions & 6 deletions test/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def import_python_driver():

# -- validate the built driver

if not all(map(lambda x: os.path.isfile(os.path.join(driverPath, x)), ['__init__.py', 'ast.py', 'docs.py'])):
if not all(map(lambda x: os.path.isfile(os.path.join(driverPath, x)), ['__init__.py', 'ast.py'])):
raise ValueError('Invalid Python driver: %s' % driverPath)

# -- load the driver
Expand All @@ -228,8 +228,7 @@ def import_python_driver():

# -- return the loaded module

__loadedPythonDriver = loadedDriver.r if inspect.isclass(loadedDriver) else loadedDriver
return __loadedPythonDriver
return loadedDriver.r if inspect.ismodule(loadedDriver) else loadedDriver

class PerformContinuousAction(threading.Thread):
'''Use to continuously perform an action on a table. Either provide an action (reql command without run) on instantiation, or subclass and override runAction'''
Expand Down Expand Up @@ -298,11 +297,11 @@ def run(self):
def stop(self):
self.stopSignal = True
self.join(timeout=.5)
if self.isAlive():
if self.is_alive():
raise Warning('performContinuousAction failed to stop when asked to, results might not be trustable')

def errorSummary(self):
if self.isAlive():
if self.is_alive():
self.stop()

return self.recordedErrors
Expand Down Expand Up @@ -661,7 +660,7 @@ def nonblocking_readline(source, seek=0):
if not os.path.isfile(source):
raise ValueError('can not find the source file: %s' % str(source))
try:
source = open(source, 'rU')
source = open(source, 'r')
except Exception as e:
raise ValueError('bad source file: %s got error: %s' % (str(source), str(e)))

Expand Down

0 comments on commit 779b734

Please sign in to comment.