Skip to content

Commit 5a4c03a

Browse files
committed
[154] Rewrite tests to use pynuoadmin rather than entity
In NuoDB 4.0 and above the previous NuoDB Agent administrative layer is deprecated in favor of the NuoDB Admin layer, and in NuoDB 4.2 and above NuoDB Agent is obsolete. This means that the pynuodb "entity" layer is no longer useful: instead users should use the pynuoadmin module to manage NuoDB databases. Further, NuoDB 4.2 provides a new Vectorized Execution Engine as its preferred SQL interface. This commit modifies the tests for this new world. First, it removes the entity tests altogether as it's not possible (as of NuoDB 4.2) to use them with a database. Second, it creates module-level operations to re-implement the entity-based database management (create/start/stop) used by the tests using the pynuoadmin interface. Unfortunately pynuoadmin still requires Python 2, while pynuodb supports both Python 2 and 3, so also re-implement the database management using the nuocmd CLI so that the tests will run with Python 3. This is the implementation which is currently used. Finally, VEE removes some support for obsolete features (such as the "number" SQL type) which were used by the tests; remove references to them.
1 parent 1db7fe0 commit 5a4c03a

14 files changed

Lines changed: 528 additions & 669 deletions

.travis.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dist: xenial
1+
dist: focal
22

33
language: python
44

@@ -10,8 +10,8 @@ env:
1010
global:
1111
- TZ=America/New_York
1212
- NUO_DOWNLOAD=https://ce-downloads.nuohub.org
13-
- NUO_ADD_DOMAIN_PASS=yes
14-
- NUO_START_AGENT=yes
13+
- NUO_PREFIX=nuodb-ce
14+
- NUO_ENABLE_TLS=false
1515
- NUODB_HOME=/opt/nuodb
1616

1717
notifications:
@@ -21,20 +21,19 @@ notifications:
2121
before_install:
2222
- echo madvise | sudo tee /sys/kernel/mm/transparent_hugepage/enabled >/dev/null
2323
- echo madvise | sudo tee /sys/kernel/mm/transparent_hugepage/defrag >/dev/null
24-
- wget -q "${NUO_DOWNLOAD}/supportedversions.txt" --output-document=/tmp/supportedversions.txt
25-
- wget -q "${NUO_DOWNLOAD}/nuodb-ce_$(tail -n1 /tmp/supportedversions.txt)_amd64.deb" --output-document=/var/tmp/nuodb.deb
24+
- wget -q "$NUO_DOWNLOAD/supportedversions.txt" --output-document=/tmp/supportedversions.txt
25+
- wget -q "$NUO_DOWNLOAD/${NUO_PREFIX}_$(tail -n1 /tmp/supportedversions.txt)_amd64.deb" --output-document=/var/tmp/nuodb.deb
2626
- sudo dpkg -i /var/tmp/nuodb.deb
2727

2828
install:
2929
- make install
3030

3131
before_script:
32-
- if [ "$NUO_ADD_DOMAIN_PASS" = yes ]; then printf '\ndomainPassword = bird\n' | sudo tee -a "$NUODB_HOME"/etc/default.properties >/dev/null; fi
33-
- if [ "$NUO_START_AGENT" = yes ]; then sudo service nuoagent start; fi
32+
- make start-nuoadmin NUO_ENABLE_TLS=$NUO_ENABLE_TLS
3433

3534
script:
36-
- make test
35+
- make test NUODB_HOME=$NUODB_HOME
3736

3837
after_failure:
39-
- cat "$NUODB_HOME"/etc/default.properties
40-
- cat /var/log/nuodb/agent.log
38+
- cat /var/log/nuodb/nuoadmin.log*
39+
- grep ssl /etc/nuodb/nuoadmin.conf

Makefile

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2015, NuoDB, Inc.
2+
# Copyright (c) 2015-2021, NuoDB, Inc.
33
# All rights reserved.
44
#
55
# Redistribution and use in source and binary forms, with or without
@@ -38,6 +38,13 @@ VIRTDIR ?= ./.virttemp
3838

3939
PYTEST_ARGS ?=
4040

41+
PYTEST_OPTS ?=
42+
PYTEST_COV ?= --cov=pynuodb --cov-report html --cov-report term-missing
43+
44+
SUDO ?= sudo -n
45+
NUODB_HOME ?= /opt/nuodb
46+
NUO_CONFIG ?= /etc/nuodb/nuoadmin.conf
47+
4148
all:
4249
$(MAKE) install
4350
$(MAKE) test
@@ -48,18 +55,24 @@ install:
4855
test:
4956
$(PIP) install '.[crypto]'
5057
$(PIP) install -r test_requirements.txt
51-
TMPDIR='$(TMPDIR)' py.test --cov=pynuodb --cov-report html --cov-report term-missing $(PYTEST_ARGS)
58+
TMPDIR='$(TMPDIR)' PATH="$(NUODB_HOME)/bin:$$PATH" \
59+
pytest $(PYTEST_COV) $(PYTEST_OPTS) $(PYTEST_ARGS)
5260

5361
virtual-%:
5462
$(RMDIR) '$(VIRTDIR)'
5563
$(VIRTUALENV) -p $(PYTHON) '$(VIRTDIR)'
5664
. '$(VIRTDIR)/bin/activate' && $(MAKE) '$*'
5765

66+
start-nuoadmin:
67+
$(SUDO) sed -ie 's,^\( *"ssl": *\)"[^"]*",\1"'"$(NUO_ENABLE_TLS)"'",' $(NUO_CONFIG)
68+
$(SUDO) systemctl start nuoadmin
69+
70+
5871
deploy:
5972
$(PYTHON) setup.py register
6073
$(PYTHON) setup.py sdist upload
6174

62-
clean:
75+
clean:
6376
$(RMDIR) build/ dist/ *.egg-info htmlcov/
6477

6578
doc:

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
"""Set up the NuoDB Python Driver package
44
5-
(C) Copyright 2013-2020 NuoDB, Inc. All Rights Reserved.
5+
(C) Copyright 2013-2021 NuoDB, Inc. All Rights Reserved.
66
77
This software is licensed under a BSD 3-Clause License.
88
See the LICENSE file provided with this software.
@@ -22,7 +22,7 @@
2222
import os
2323
import re
2424

25-
from setuptools import setup, find_packages
25+
from setuptools import setup
2626

2727
with open(os.path.join(os.path.dirname(__file__), 'pynuodb', '__init__.py')) as v:
2828
VERSION = re.compile(r"^ *__version__ *= *'(.*?)'", re.M).search(v.read()).group(1)

test_requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ coverage>=3.7
55
pytest-cov>=1.8.1
66
coveralls>=0.5
77
python-coveralls>=2.5
8+
pynuoadmin

0 commit comments

Comments
 (0)