Add processing for additional tests status 'skipped'
In models for enum attribute of Test entity new value has been added. addError hook method of StoragePlugin has been modified with purpose to process new result state of executed tests which now can be 'skipped'. Unit and functional tests were updated. Change-Id: I593d67eed12a9a20ba795501a1f8cceedfbb4587 Implements: blueprint additional-tests-statuses
This commit is contained in:
18
fabfile.py
vendored
18
fabfile.py
vendored
@@ -107,21 +107,3 @@ def integration():
|
||||
|
||||
def unit():
|
||||
local('nosetests fuel_plugin/testing/tests/unit -v')
|
||||
|
||||
|
||||
def masstest():
|
||||
for i in range(10):
|
||||
testall()
|
||||
|
||||
|
||||
def testissue():
|
||||
for i in range(100):
|
||||
local(
|
||||
('nosetests -sv fuel_plugin/testing/tests/functional/'
|
||||
'tests.py:AdapterTests.test_start_many_runs')
|
||||
)
|
||||
|
||||
|
||||
def massintegration():
|
||||
for i in range(20):
|
||||
integration()
|
||||
|
||||
@@ -15,11 +15,12 @@
|
||||
from time import time
|
||||
import logging
|
||||
import os
|
||||
|
||||
from nose import plugins
|
||||
from pecan import conf
|
||||
from fuel_plugin.ostf_adapter.nose_plugin import nose_utils
|
||||
import unittest
|
||||
import unittest2
|
||||
|
||||
from fuel_plugin.ostf_adapter.nose_plugin import nose_utils
|
||||
from fuel_plugin.ostf_adapter.storage import models, engine
|
||||
|
||||
|
||||
@@ -84,10 +85,13 @@ class StoragePlugin(plugins.Plugin):
|
||||
self._add_message(test, err=err, status='failure')
|
||||
|
||||
def addError(self, test, err):
|
||||
if err[0] == AssertionError:
|
||||
if err[0] is AssertionError:
|
||||
LOG.error('%s', test.id(), exc_info=err)
|
||||
self._add_message(
|
||||
test, err=err, status='failure')
|
||||
self._add_message(test, err=err, status='failure')
|
||||
elif issubclass(err[0], unittest.SkipTest) \
|
||||
or issubclass(err[0], unittest2.SkipTest):
|
||||
LOG.warning('%s is skipped', test.id())
|
||||
self._add_message(test, err=err, status='skipped')
|
||||
else:
|
||||
LOG.error('%s', test.id(), exc_info=err)
|
||||
self._add_message(test, err=err, status='error')
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
"""initial
|
||||
|
||||
Revision ID: 1fd6054552f1
|
||||
Revision ID: 53af7c2d9ccc
|
||||
Revises: None
|
||||
Create Date: 2013-11-22 19:05:47.553587
|
||||
Create Date: 2013-12-04 13:32:29.109891
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '1fd6054552f1'
|
||||
revision = '53af7c2d9ccc'
|
||||
down_revision = None
|
||||
|
||||
from alembic import op
|
||||
@@ -19,6 +19,13 @@ from fuel_plugin.ostf_adapter.storage import fields
|
||||
|
||||
def upgrade():
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table(
|
||||
'cluster_state',
|
||||
sa.Column('id', sa.Integer(), autoincrement=False, nullable=False),
|
||||
sa.Column('deployment_tags', postgresql.ARRAY(sa.String(length=64)),
|
||||
nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table(
|
||||
'test_sets',
|
||||
sa.Column('id', sa.String(length=128), nullable=False),
|
||||
@@ -33,19 +40,11 @@ def upgrade():
|
||||
sa.Column('test_runs_ordering_priority', sa.Integer(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table(
|
||||
'cluster_state',
|
||||
sa.Column('id', sa.Integer(), autoincrement=False, nullable=False),
|
||||
sa.Column('deployment_tags', postgresql.ARRAY(sa.String(length=64)),
|
||||
nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table(
|
||||
'cluster_testing_pattern',
|
||||
sa.Column('cluster_id', sa.Integer(), nullable=False),
|
||||
sa.Column('test_set_id', sa.String(length=128), nullable=False),
|
||||
sa.Column('tests',
|
||||
postgresql.ARRAY(sa.String(length=512)),
|
||||
sa.Column('tests', postgresql.ARRAY(sa.String(length=512)),
|
||||
nullable=True),
|
||||
sa.ForeignKeyConstraint(['cluster_id'], ['cluster_state.id'], ),
|
||||
sa.ForeignKeyConstraint(['test_set_id'], ['test_sets.id'], ),
|
||||
@@ -62,11 +61,10 @@ def upgrade():
|
||||
sa.Column('ended_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('test_set_id', sa.String(length=128), nullable=True),
|
||||
sa.Column('cluster_id', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(
|
||||
['test_set_id', 'cluster_id'],
|
||||
['cluster_testing_pattern.test_set_id',
|
||||
'cluster_testing_pattern.cluster_id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.ForeignKeyConstraint(['test_set_id', 'cluster_id'],
|
||||
['cluster_testing_pattern.test_set_id',
|
||||
'cluster_testing_pattern.cluster_id'],
|
||||
ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table(
|
||||
@@ -78,9 +76,9 @@ def upgrade():
|
||||
sa.Column('duration', sa.String(length=512), nullable=True),
|
||||
sa.Column('message', sa.Text(), nullable=True),
|
||||
sa.Column('traceback', sa.Text(), nullable=True),
|
||||
sa.Column('status',
|
||||
sa.Enum('wait_running', 'running', 'failure', 'success',
|
||||
'error', 'stopped', 'disabled', name='test_states'),
|
||||
sa.Column('status', sa.Enum('wait_running', 'running', 'failure',
|
||||
'success', 'error', 'stopped',
|
||||
'disabled', 'skipped', name='test_states'),
|
||||
nullable=True),
|
||||
sa.Column('step', sa.Integer(), nullable=True),
|
||||
sa.Column('time_taken', sa.Float(), nullable=True),
|
||||
@@ -103,6 +101,6 @@ def downgrade():
|
||||
op.drop_table('tests')
|
||||
op.drop_table('test_runs')
|
||||
op.drop_table('cluster_testing_pattern')
|
||||
op.drop_table('cluster_state')
|
||||
op.drop_table('test_sets')
|
||||
op.drop_table('cluster_state')
|
||||
### end Alembic commands ###
|
||||
@@ -113,7 +113,8 @@ class Test(BASE):
|
||||
'success',
|
||||
'error',
|
||||
'stopped',
|
||||
'disabled'
|
||||
'disabled',
|
||||
'skipped'
|
||||
)
|
||||
|
||||
id = sa.Column(sa.Integer(), primary_key=True)
|
||||
|
||||
@@ -23,10 +23,10 @@ __profile__ = {
|
||||
|
||||
import time
|
||||
import httplib
|
||||
import unittest
|
||||
import unittest2
|
||||
|
||||
|
||||
class Dummy_test(unittest.TestCase):
|
||||
class Dummy_test(unittest2.TestCase):
|
||||
"""Class docstring is required?
|
||||
"""
|
||||
|
||||
@@ -61,3 +61,15 @@ class Dummy_test(unittest.TestCase):
|
||||
"""Fast fail with step
|
||||
"""
|
||||
self.fail('Step 3 Failed: Fake fail message')
|
||||
|
||||
def test_skip(self):
|
||||
"""Skip
|
||||
"""
|
||||
msg = 'The reason to skip goes here'
|
||||
self.skipTest(msg)
|
||||
|
||||
def test_skip_directly(self):
|
||||
"""Skip with exception
|
||||
"""
|
||||
msg = 'Nothing to see here'
|
||||
raise unittest2.SkipTest(msg)
|
||||
|
||||
@@ -38,6 +38,10 @@ class AdapterTests(BaseAdapterTest):
|
||||
'general_test.Dummy_test.test_long_pass'): 'long_pass',
|
||||
('fuel_plugin.testing.fixture.dummy_tests.'
|
||||
'general_test.Dummy_test.test_fail_with_step'): 'fail_step',
|
||||
('fuel_plugin.testing.fixture.dummy_tests.'
|
||||
'general_test.Dummy_test.test_skip'): 'skip',
|
||||
('fuel_plugin.testing.fixture.dummy_tests.'
|
||||
'general_test.Dummy_test.test_skip_directly'): 'skip_directly',
|
||||
('fuel_plugin.testing.fixture.dummy_tests.stopped_test.'
|
||||
'dummy_tests_stopped.test_really_long'): 'really_long',
|
||||
('fuel_plugin.testing.fixture.dummy_tests.stopped_test.'
|
||||
@@ -56,6 +60,8 @@ class AdapterTests(BaseAdapterTest):
|
||||
'fast_error',
|
||||
'fast_fail',
|
||||
'long_pass',
|
||||
'skip',
|
||||
'skip_directly'
|
||||
],
|
||||
"stopped_test": [
|
||||
'really_long',
|
||||
@@ -275,6 +281,18 @@ class AdapterTests(BaseAdapterTest):
|
||||
'name': 'Will sleep 5 sec',
|
||||
'id': ('fuel_plugin.testing.fixture.dummy_tests.'
|
||||
'general_test.Dummy_test.test_long_pass'),
|
||||
},
|
||||
{
|
||||
'status': 'disabled',
|
||||
'name': 'Skip',
|
||||
'id': ('fuel_plugin.testing.fixture.dummy_tests.'
|
||||
'general_test.Dummy_test.test_skip'),
|
||||
},
|
||||
{
|
||||
'status': 'disabled',
|
||||
'name': 'Skip with exception',
|
||||
'id': ('fuel_plugin.testing.fixture.dummy_tests.'
|
||||
'general_test.Dummy_test.test_skip_directly'),
|
||||
}
|
||||
],
|
||||
'cluster_id': '1',
|
||||
@@ -348,6 +366,18 @@ class AdapterTests(BaseAdapterTest):
|
||||
'name': 'Will sleep 5 sec',
|
||||
'id': ('fuel_plugin.testing.fixture.dummy_tests.'
|
||||
'general_test.Dummy_test.test_long_pass'),
|
||||
},
|
||||
{
|
||||
'status': 'skipped',
|
||||
'name': 'Skip',
|
||||
'id': ('fuel_plugin.testing.fixture.dummy_tests.'
|
||||
'general_test.Dummy_test.test_skip'),
|
||||
},
|
||||
{
|
||||
'status': 'skipped',
|
||||
'name': 'Skip with exception',
|
||||
'id': ('fuel_plugin.testing.fixture.dummy_tests.'
|
||||
'general_test.Dummy_test.test_skip_directly'),
|
||||
}
|
||||
],
|
||||
'cluster_id': '1',
|
||||
@@ -426,6 +456,18 @@ class AdapterTests(BaseAdapterTest):
|
||||
'name': 'Will sleep 5 sec',
|
||||
'id': ('fuel_plugin.testing.fixture.dummy_tests.'
|
||||
'general_test.Dummy_test.test_long_pass'),
|
||||
},
|
||||
{
|
||||
'status': 'disabled',
|
||||
'name': 'Skip',
|
||||
'id': ('fuel_plugin.testing.fixture.dummy_tests.'
|
||||
'general_test.Dummy_test.test_skip'),
|
||||
},
|
||||
{
|
||||
'status': 'disabled',
|
||||
'name': 'Skip with exception',
|
||||
'id': ('fuel_plugin.testing.fixture.dummy_tests.'
|
||||
'general_test.Dummy_test.test_skip_directly'),
|
||||
}
|
||||
],
|
||||
'cluster_id': '1',
|
||||
|
||||
@@ -52,6 +52,8 @@ class BaseWSGITest(unittest2.TestCase):
|
||||
'general_test.Dummy_test.test_fast_fail',
|
||||
'general_test.Dummy_test.test_fast_error',
|
||||
'general_test.Dummy_test.test_fail_with_step',
|
||||
'general_test.Dummy_test.test_skip',
|
||||
'general_test.Dummy_test.test_skip_directly',
|
||||
'stopped_test.dummy_tests_stopped.test_really_long',
|
||||
'stopped_test.dummy_tests_stopped.test_one_no_so_long',
|
||||
'stopped_test.dummy_tests_stopped.test_not_long_at_all'
|
||||
|
||||
@@ -59,7 +59,7 @@ class TestNoseDiscovery(unittest2.TestCase):
|
||||
def test_discovery(self):
|
||||
expected = {
|
||||
'test_sets_count': 6,
|
||||
'tests_count': 20
|
||||
'tests_count': 22
|
||||
}
|
||||
|
||||
self.assertTrue(
|
||||
|
||||
@@ -250,6 +250,8 @@ class TestClusterRedeployment(base.BaseWSGITest):
|
||||
'general_test.Dummy_test.test_fast_fail',
|
||||
'general_test.Dummy_test.test_fast_error',
|
||||
'general_test.Dummy_test.test_fail_with_step',
|
||||
'general_test.Dummy_test.test_skip',
|
||||
'general_test.Dummy_test.test_skip_directly',
|
||||
'stopped_test.dummy_tests_stopped.test_really_long',
|
||||
'stopped_test.dummy_tests_stopped.test_one_no_so_long',
|
||||
'stopped_test.dummy_tests_stopped.test_not_long_at_all'
|
||||
|
||||
Reference in New Issue
Block a user