Migrate to testr
Change-Id: If06ed4cd26a7be5cb14af20ba5d79ff849674cf6
This commit is contained in:
parent
5524891eab
commit
879c78fe76
|
@ -0,0 +1,7 @@
|
|||
[DEFAULT]
|
||||
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
|
||||
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
|
||||
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
|
||||
${PYTHON:-python} -m subunit.run discover savannadashboard/tests $LISTOPT $IDOPTION
|
||||
test_id_option=--load-list $IDFILE
|
||||
test_list_option=--list
|
|
@ -32,10 +32,10 @@ Information about installation and start of savanna and horizon can be found on
|
|||
sudo apt-get update
|
||||
sudo apt-get install firefox libstdc++5
|
||||
|
||||
5. To run ui tests you should use the corresponding tox env: `tox -e tests`.
|
||||
5. To run ui tests you should use the corresponding tox env: `tox -e uitests`.
|
||||
If need to run only one test module, use:
|
||||
|
||||
tox -e tests -- -a tags='<module_name>'
|
||||
tox -e uitests -- '<module_name>'
|
||||
|
||||
<module_name> may be equal 'cluster', 'cluster_template', 'image_registry', 'node_group_template', 'image_registry', 'vanilla', 'hdp'
|
||||
It's full list of actual modules.
|
||||
|
|
|
@ -18,12 +18,10 @@ import os
|
|||
import time
|
||||
import traceback
|
||||
|
||||
import nose.plugins.attrib
|
||||
import selenium.common.exceptions as selenim_except
|
||||
from selenium import webdriver
|
||||
import selenium.webdriver.common.by as by
|
||||
from swiftclient import client as swift_client
|
||||
import testtools
|
||||
import unittest2
|
||||
|
||||
import savannadashboard.tests.configs.config as cfg
|
||||
|
@ -33,18 +31,6 @@ logger = logging.getLogger('swiftclient')
|
|||
logger.setLevel(logging.WARNING)
|
||||
|
||||
|
||||
def attr(*args, **kwargs):
|
||||
def decorator(f):
|
||||
if 'type' in kwargs and isinstance(kwargs['type'], str):
|
||||
f = testtools.testcase.attr(kwargs['type'])(f)
|
||||
elif 'type' in kwargs and isinstance(kwargs['type'], list):
|
||||
for attr in kwargs['type']:
|
||||
f = testtools.testcase.attr(attr)(f)
|
||||
return nose.plugins.attrib.attr(*args, **kwargs)(f)
|
||||
|
||||
return decorator
|
||||
|
||||
|
||||
class UITestCase(unittest2.TestCase):
|
||||
|
||||
@classmethod
|
||||
|
@ -267,7 +253,7 @@ class UITestCase(unittest2.TestCase):
|
|||
"//select[@id='id_job_binary_savanna_internal']/option[text()"
|
||||
"='%s']" % savanna_binary).click()
|
||||
if savanna_binary == '*Upload a new file':
|
||||
file = '%s/tests/resources/%s' % (
|
||||
file = '%s/savannadashboard/tests/resources/%s' % (
|
||||
os.getcwd(), parameters_of_storage['filename'])
|
||||
driver.find_element_by_id('id_job_binary_file').send_keys(file)
|
||||
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import testtools
|
||||
from testtools import testcase
|
||||
import unittest2
|
||||
|
||||
from savannadashboard.tests import base
|
||||
import savannadashboard.tests.configs.config as cfg
|
||||
|
@ -21,9 +22,9 @@ import savannadashboard.tests.configs.config as cfg
|
|||
|
||||
class UINegativeCreateClusterTemplateTest(base.UITestCase):
|
||||
|
||||
@base.attr(tags=['cluster_template', 'vanilla'])
|
||||
@testtools.skip
|
||||
@testtools.skipIf(cfg.vanilla.skip_plugin_tests,
|
||||
@testcase.attr('cluster_template', 'vanilla')
|
||||
@unittest2.skip
|
||||
@unittest2.skipIf(cfg.vanilla.skip_plugin_tests,
|
||||
'tests for vanilla plugin skipped')
|
||||
def test_create_vanilla_cluster_template_with_wrong_fields(self):
|
||||
self.create_node_group_template('selenium-master', ["NN", "JT"],
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import testtools
|
||||
from testtools import testcase
|
||||
import unittest2
|
||||
|
||||
from savannadashboard.tests import base
|
||||
import savannadashboard.tests.configs.config as cfg
|
||||
|
@ -21,8 +22,8 @@ import savannadashboard.tests.configs.config as cfg
|
|||
|
||||
class UICreateClusterTemplate(base.UITestCase):
|
||||
|
||||
@base.attr(tags=['cluster_template', 'vanilla'])
|
||||
@testtools.skipIf(cfg.vanilla.skip_plugin_tests,
|
||||
@testcase.attr('cluster_template', 'vanilla')
|
||||
@unittest2.skipIf(cfg.vanilla.skip_plugin_tests,
|
||||
'tests for vanilla plugin skipped')
|
||||
def test_create_cluster_template_for_vanilla(self):
|
||||
self.create_node_group_template('selenium-master', ["NN", "JT"],
|
||||
|
@ -52,8 +53,8 @@ class UICreateClusterTemplate(base.UITestCase):
|
|||
self.delete_node_group_templates(["selenium-master",
|
||||
"selenium-worker"])
|
||||
|
||||
@base.attr(tags=['cluster_template', 'hdp'])
|
||||
@testtools.skipIf(cfg.hdp.skip_plugin_tests,
|
||||
@testcase.attr('cluster_template', 'hdp')
|
||||
@unittest2.skipIf(cfg.hdp.skip_plugin_tests,
|
||||
'tests for hdp plugin skipped')
|
||||
def test_create_cluster_template_for_hdp(self):
|
||||
self.create_node_group_template(
|
||||
|
|
|
@ -15,8 +15,10 @@
|
|||
|
||||
import random
|
||||
import string
|
||||
import testtools
|
||||
from testtools import testcase
|
||||
import traceback
|
||||
import unittest2
|
||||
|
||||
|
||||
from savannadashboard.tests import base
|
||||
import savannadashboard.tests.configs.config as cfg
|
||||
|
@ -24,8 +26,8 @@ import savannadashboard.tests.configs.config as cfg
|
|||
|
||||
class UICreateCluster(base.UITestCase):
|
||||
|
||||
@base.attr(tags=['cluster', 'vanilla'], speed='slow')
|
||||
@testtools.skipIf(cfg.vanilla.skip_plugin_tests,
|
||||
@testcase.attr('cluster', 'vanilla')
|
||||
@unittest2.skipIf(cfg.vanilla.skip_plugin_tests,
|
||||
'tests for vanilla plugin skipped')
|
||||
def test_create_vanilla_cluster(self):
|
||||
|
||||
|
@ -133,7 +135,8 @@ class UICreateCluster(base.UITestCase):
|
|||
'storage_type': 'Savanna internal database',
|
||||
'Savanna binary': '*Create a script',
|
||||
'script_name': 'edp-job.pig',
|
||||
'script_text': open('tests/resources/edp-job.pig').read()}
|
||||
'script_text': open('savannadashboard/tests/resources/'
|
||||
'edp-job.pig').read()}
|
||||
|
||||
self.create_job_binary('edp-job.pig', parameters_of_storage)
|
||||
|
||||
|
|
|
@ -130,7 +130,8 @@ def register_config(config, config_group, config_opts):
|
|||
config.register_group(config_group)
|
||||
config.register_opts(config_opts, config_group)
|
||||
|
||||
path = os.path.join("%s/tests/configs/config.conf" % os.getcwd())
|
||||
path = os.path.join("%s/savannadashboard/tests/configs/config.conf"
|
||||
% os.getcwd())
|
||||
|
||||
if os.path.exists(path):
|
||||
cfg.CONF([], project='savannadashboard', default_config_files=[path])
|
||||
|
|
|
@ -13,13 +13,15 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from testtools import testcase
|
||||
|
||||
from savannadashboard.tests import base
|
||||
import savannadashboard.tests.configs.config as cfg
|
||||
|
||||
|
||||
class UIImageRegistry(base.UITestCase):
|
||||
|
||||
@base.attr(tags='image_registry')
|
||||
@testcase.attr('image_registry')
|
||||
def test_edit_tags_for_image(self):
|
||||
self.edit_tags_by_image_name(cfg.common.image_name_for_edit,
|
||||
tags_to_add=[
|
||||
|
@ -30,7 +32,7 @@ class UIImageRegistry(base.UITestCase):
|
|||
tags_to_add=[{'custom_tag': 'qweqwe'}],
|
||||
tags_to_remove=['qweqwe', 'blabla'])
|
||||
|
||||
@base.attr(tags='image_registry')
|
||||
@testcase.attr('image_registry')
|
||||
def test_registry_vanilla_image(self):
|
||||
self.image_registry(cfg.common.image_name_for_register,
|
||||
user_name='cloud_user',
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import testtools
|
||||
from testtools import testcase
|
||||
import unittest2
|
||||
|
||||
from savannadashboard.tests import base
|
||||
import savannadashboard.tests.configs.config as cfg
|
||||
|
@ -21,8 +22,8 @@ import savannadashboard.tests.configs.config as cfg
|
|||
|
||||
class UINegativeCreateNodeGroupTemplate(base.UITestCase):
|
||||
|
||||
@base.attr(tags=['node_group_template', 'vanilla'])
|
||||
@testtools.skipIf(cfg.vanilla.skip_plugin_tests,
|
||||
@testcase.attr('node_group_template', 'vanilla')
|
||||
@unittest2.skipIf(cfg.vanilla.skip_plugin_tests,
|
||||
'tests for vanilla plugin skipped')
|
||||
def test_create_vanilla_node_group_template_with_wrong_parameters(self):
|
||||
self.create_node_group_template(
|
||||
|
@ -38,8 +39,8 @@ class UINegativeCreateNodeGroupTemplate(base.UITestCase):
|
|||
'MapReduce Parameters:io.sort.mb:'
|
||||
'Enter a whole number.')
|
||||
|
||||
@base.attr(tags=['node_group_template', 'vanilla'])
|
||||
@testtools.skipIf(cfg.vanilla.skip_plugin_tests,
|
||||
@testcase.attr('node_group_template', 'vanilla')
|
||||
@unittest2.skipIf(cfg.vanilla.skip_plugin_tests,
|
||||
'tests for vanilla plugin skipped')
|
||||
def test_create_vanilla_node_group_template_with_missing_parameters(self):
|
||||
self.create_node_group_template(
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import testtools
|
||||
from testtools import testcase
|
||||
import unittest2
|
||||
|
||||
from savannadashboard.tests import base
|
||||
import savannadashboard.tests.configs.config as cfg
|
||||
|
@ -21,8 +22,8 @@ import savannadashboard.tests.configs.config as cfg
|
|||
|
||||
class UICreateNodeGroupTemplate(base.UITestCase):
|
||||
|
||||
@base.attr(tags=['node_group_template', 'vanilla'])
|
||||
@testtools.skipIf(cfg.vanilla.skip_plugin_tests,
|
||||
@testcase.attr('node_group_template', 'vanilla')
|
||||
@unittest2.skipIf(cfg.vanilla.skip_plugin_tests,
|
||||
'tests for vanilla plugin skipped')
|
||||
def test_create_node_group_template_vanilla(self):
|
||||
self.create_node_group_template(
|
||||
|
@ -44,8 +45,8 @@ class UICreateNodeGroupTemplate(base.UITestCase):
|
|||
message=msg)
|
||||
self.delete_node_group_templates(['selenium-vanilla'])
|
||||
|
||||
@base.attr(tags=['node_group_template', 'hdp'])
|
||||
@testtools.skipIf(cfg.hdp.skip_plugin_tests,
|
||||
@testcase.attr('node_group_template', 'hdp')
|
||||
@unittest2.skipIf(cfg.hdp.skip_plugin_tests,
|
||||
'tests for hdp plugin skipped')
|
||||
def test_create_node_group_template_hdp(self):
|
||||
self.create_node_group_template(
|
||||
|
|
11
setup.cfg
11
setup.cfg
|
@ -23,14 +23,3 @@ setup-hooks = pbr.hooks.setup_hook
|
|||
[files]
|
||||
packages =
|
||||
savannadashboard
|
||||
|
||||
[nosetests]
|
||||
cover-package=savanna
|
||||
cover-html=true
|
||||
cover-xml=true
|
||||
cover-xml-file=coverage.xml
|
||||
cover-erase=true
|
||||
cover-inclusive=true
|
||||
verbosity=3
|
||||
detailed-errors=1
|
||||
where=savannadashboard/
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
hacking>=0.8.0,<0.9
|
||||
|
||||
coverage>=3.6
|
||||
discover
|
||||
mock>=1.0
|
||||
nose
|
||||
openstack.nose_plugin>=0.7
|
||||
python-swiftclient>=1.5
|
||||
pylint==0.25.2
|
||||
unittest2
|
||||
selenium
|
||||
testtools>=0.9.32
|
||||
oslo.config>=1.2.0
|
||||
pylint==0.25.2
|
||||
python-swiftclient>=1.5
|
||||
selenium
|
||||
testrepository>=0.0.17
|
||||
testtools>=0.9.32
|
||||
unittest2
|
||||
|
|
20
tox.ini
20
tox.ini
|
@ -8,31 +8,15 @@ usedevelop = True
|
|||
install_command = pip install -U {opts} {packages}
|
||||
setenv =
|
||||
VIRTUAL_ENV={envdir}
|
||||
NOSE_WITH_OPENSTACK=1
|
||||
NOSE_OPENSTACK_COLOR=1
|
||||
NOSE_OPENSTACK_RED=0.05
|
||||
NOSE_OPENSTACK_YELLOW=0.025
|
||||
NOSE_OPENSTACK_SHOW_ELAPSED=1
|
||||
NOSE_OPENSTACK_STDOUT=1
|
||||
NOSE_XUNIT=1
|
||||
deps =
|
||||
-r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
|
||||
[testenv:uitests]
|
||||
setenv =
|
||||
VIRTUAL_ENV={envdir}
|
||||
NOSE_WITH_OPENSTACK=1
|
||||
NOSE_OPENSTACK_COLOR=1
|
||||
NOSE_OPENSTACK_RED=200
|
||||
NOSE_OPENSTACK_YELLOW=150
|
||||
NOSE_OPENSTACK_SHOW_ELAPSED=1
|
||||
NOSE_OPENSTACK_STDOUT=1
|
||||
NOSE_XUNIT=1
|
||||
commands = nosetests -w tests -x {posargs}
|
||||
commands = python setup.py testr --slowest --testr-args="--concurrency 1 {posargs}"
|
||||
|
||||
[testenv:cover]
|
||||
setenv = NOSE_WITH_COVERAGE=1
|
||||
commands = python setup.py testr --coverage --testr-args='--concurrency 1 {posargs}'
|
||||
|
||||
[tox:jenkins]
|
||||
downloadcache = ~/cache/pip
|
||||
|
|
Loading…
Reference in New Issue