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 bfcddfd
Show file tree
Hide file tree
Showing 19 changed files with 278 additions and 260 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
2 changes: 1 addition & 1 deletion scripts/visualize_btree.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def btree_to_html(btree, filename):

superblock, values = btree

with file(filename, "w") as f:
with open(filename, "w") as f:
sys.stdout = f
try:
print """
Expand Down
5 changes: 2 additions & 3 deletions scripts/visualize_log_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,15 +660,14 @@ def print_html(self):

def file_to_database(filename):

with file(filename) as f:
with open(filename) as f:
text = f.read()

return Database(text)

def database_to_html(db, filename):

with file(filename, "w") as f:

with open(filename, "w") as f:
sys.stdout = f

try:
Expand Down
2 changes: 1 addition & 1 deletion test/common/http_support/jinja2/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def get_source(self, environment, template):
if not exists(path):
raise TemplateNotFound(template)
mtime = getmtime(path)
with file(path) as f:
with open(path) as f:
source = f.read().decode('utf-8')
return source, path, lambda: mtime == getmtime(path)
"""
Expand Down
7 changes: 4 additions & 3 deletions test/common/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def update_status(self):
self.show_status()

def clear_status(self):
self.buffer += self.clear_line
self.buffer += self.clear_line.decode()

def show_status(self):
if self.running_list:
Expand Down 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 Expand Up @@ -961,7 +962,7 @@ def killed(self):
return os.path.exists(join(self.dir, "killed"))

def dump_file(self, name):
with file(join(self.dir, name)) as f:
with open(join(self.dir, name)) as f:
for line in f:
print(line, end=' ')

Expand Down
13 changes: 6 additions & 7 deletions test/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def print_with_time(*args, **kwargs): # add timing information to print statemen
sys.stdout.flush()

def guess_is_text_file(name):
with file(name, 'rb') as f:
with open(name, 'rb') as f:
data = f.read(100)
for byte in data:
if ord(byte) in non_text_bytes:
Expand Down 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
2 changes: 1 addition & 1 deletion test/memcached_workloads/multi_serial_mix.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def time_remaining():

if stuck or failed:
for id in stuck + failed:
with file(os.path.join(tester_log_dir, str(id) + ".txt")) as f:
with open(os.path.join(tester_log_dir, str(id) + ".txt"), "w") as f:
for line in f:
sys.stdout.write(line)
if len(stuck) == opts["num_testers"]:
Expand Down

0 comments on commit bfcddfd

Please sign in to comment.