check update error on tempest datasoure tests

add to each polling driver test a check that poll succeeded at least once
without error.

The purpose is to catch polling errors (usually due to service client changes)
quickly.

Closes-Bug: 1669164

Change-Id: I2df2b813e0eb187cfd795a3fbd72240c127f61a4
This commit is contained in:
Eric Kao 2017-03-23 16:29:23 -07:00
parent 0f6dcb6d6c
commit bd0d0c5e3d
12 changed files with 216 additions and 0 deletions

View File

@ -96,3 +96,11 @@ class TestAodhDriver(manager_congress.ScenarioPolicyBase):
duration=100, sleep_for=5):
raise exceptions.TimeoutException("Data did not converge in time "
"or failure in server")
@test.attr(type='smoke')
def test_update_no_error(self):
if not test_utils.call_until_true(
func=lambda: self.check_datasource_no_error('aodh'),
duration=30, sleep_for=5):
raise exceptions.TimeoutException('Datasource could not poll '
'without error.')

View File

@ -75,3 +75,11 @@ class TestCeilometerDriver(manager_congress.ScenarioPolicyBase):
duration=100, sleep_for=5):
raise exceptions.TimeoutException("Data did not converge in time "
"or failure in server")
@test.attr(type='smoke')
def test_update_no_error(self):
if not test_utils.call_until_true(
func=lambda: self.check_datasource_no_error('ceilometer'),
duration=30, sleep_for=5):
raise exceptions.TimeoutException('Datasource could not poll '
'without error.')

View File

@ -105,3 +105,11 @@ class TestCinderDriver(manager_congress.ScenarioPolicyBase):
duration=100, sleep_for=5):
raise exceptions.TimeoutException("Data did not converge in time "
"or failure in server")
@test.attr(type='smoke')
def test_update_no_error(self):
if not test_utils.call_until_true(
func=lambda: self.check_datasource_no_error('cinder'),
duration=30, sleep_for=5):
raise exceptions.TimeoutException('Datasource could not poll '
'without error.')

View File

@ -124,3 +124,11 @@ class TestGlanceV2Driver(manager_congress.ScenarioPolicyBase):
duration=100, sleep_for=5):
raise exceptions.TimeoutException("Data did not converge in time "
"or failure in server")
@test.attr(type='smoke')
def test_update_no_error(self):
if not test_utils.call_until_true(
func=lambda: self.check_datasource_no_error('glancev2'),
duration=30, sleep_for=5):
raise exceptions.TimeoutException('Datasource could not poll '
'without error.')

View File

@ -0,0 +1,45 @@
# Copyright 2017 VMware Corporation. All rights reserved.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from tempest import config
from tempest.lib.common.utils import test_utils
from tempest.lib import exceptions
from tempest import test
from congress_tempest_tests.tests.scenario import manager_congress
CONF = config.CONF
class TestHeatDriver(manager_congress.ScenarioPolicyBase):
@classmethod
def skip_checks(cls):
super(TestHeatDriver, cls).skip_checks()
if not getattr(CONF.service_available, 'heat_plugin', False):
msg = ("%s skipped because heat service is not configured" %
cls.__class__.__name__)
raise cls.skipException(msg)
# TODO(testing): checks on correctness of data in updates
@test.attr(type='smoke')
def test_update_no_error(self):
if not test_utils.call_until_true(
func=lambda: self.check_datasource_no_error('heat'),
duration=30, sleep_for=5):
raise exceptions.TimeoutException('Datasource could not poll '
'without error.')

View File

@ -0,0 +1,45 @@
# Copyright 2017 VMware Corporation. All rights reserved.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from tempest import config
from tempest.lib.common.utils import test_utils
from tempest.lib import exceptions
from tempest import test
from congress_tempest_tests.tests.scenario import manager_congress
CONF = config.CONF
class TestIronicDriver(manager_congress.ScenarioPolicyBase):
@classmethod
def skip_checks(cls):
super(TestIronicDriver, cls).skip_checks()
if not getattr(CONF.service_available, 'ironic', False):
msg = ("%s skipped because ironic service is not configured" %
cls.__class__.__name__)
raise cls.skipException(msg)
# TODO(testing): checks on correctness of data in updates
@test.attr(type='smoke')
def test_update_no_error(self):
if not test_utils.call_until_true(
func=lambda: self.check_datasource_no_error('ironic'),
duration=30, sleep_for=5):
raise exceptions.TimeoutException('Datasource could not poll '
'without error.')

View File

@ -160,3 +160,11 @@ class TestKeystoneV2Driver(manager_congress.ScenarioPolicyBase):
duration=100, sleep_for=5):
raise exceptions.TimeoutException("Data did not converge in time "
"or failure in server")
@test.attr(type='smoke')
def test_update_no_error(self):
if not test_utils.call_until_true(
func=lambda: self.check_datasource_no_error('keystone'),
duration=30, sleep_for=5):
raise exceptions.TimeoutException('Datasource could not poll '
'without error.')

View File

@ -15,6 +15,7 @@ import random
import string
from tempest import config
from tempest.lib.common.utils import test_utils
from tempest.lib import exceptions
from tempest import test
@ -196,3 +197,11 @@ class TestMuranoDriver(manager_congress.ScenarioPolicyBase):
self.assertEqual([], result)
result = _simulate_policy(policy_name, sim_query2)
self.assertEqual('predeploy_error("env_uuid")', result[0])
@test.attr(type='smoke')
def test_update_no_error(self):
if not test_utils.call_until_true(
func=lambda: self.check_datasource_no_error('murano'),
duration=30, sleep_for=5):
raise exceptions.TimeoutException('Datasource could not poll '
'without error.')

View File

@ -387,3 +387,11 @@ class TestNeutronV2Driver(manager_congress.ScenarioPolicyBase):
duration=200, sleep_for=10):
raise exceptions.TimeoutException("Data did not converge in time "
"or failure in server")
@test.attr(type='smoke')
def test_update_no_error(self):
if not test_utils.call_until_true(
func=lambda: self.check_datasource_no_error('neutronv2'),
duration=30, sleep_for=5):
raise exceptions.TimeoutException('Datasource could not poll '
'without error.')

View File

@ -141,3 +141,11 @@ class TestNovaDriver(manager_congress.ScenarioPolicyBase):
duration=100, sleep_for=5):
raise exceptions.TimeoutException("Data did not converge in time "
"or failure in server")
@test.attr(type='smoke')
def test_update_no_error(self):
if not test_utils.call_until_true(
func=lambda: self.check_datasource_no_error('nova'),
duration=30, sleep_for=5):
raise exceptions.TimeoutException('Datasource could not poll '
'without error.')

View File

@ -0,0 +1,48 @@
# Copyright 2017 VMware Inc. All rights reserved.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from tempest import config
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
from tempest.lib import exceptions
from tempest import test
from congress_tempest_tests.tests.scenario import manager_congress
CONF = config.CONF
class TestSwiftDriver(manager_congress.ScenarioPolicyBase):
@classmethod
def skip_checks(cls):
super(TestSwiftDriver, cls).skip_checks()
if not CONF.service_available.swift:
msg = ("%s skipped because swift service is not configured" %
cls.__class__.__name__)
raise cls.skipException(msg)
# TODO(testing): checks on correctness of data in updates
# swift driver experiences auth error in test
@decorators.skip_because(bug="980688")
@test.attr(type='smoke')
def test_update_no_error(self):
if not test_utils.call_until_true(
func=lambda: self.check_datasource_no_error('swift'),
duration=30, sleep_for=5):
raise exceptions.TimeoutException('Datasource could not poll '
'without error.')

View File

@ -116,6 +116,19 @@ class ScenarioPolicyBase(manager.NetworkScenarioTest):
self.assertIn(self.router['id'],
seen_router_ids)
def check_datasource_no_error(self, datasource_name):
"""Check that datasource has no error on latest update"""
ds_status = self.admin_manager.congress_client.list_datasource_status(
datasource_name)
if (ds_status['initialized'] == 'True' and
ds_status['number_of_updates'] != '0' and
ds_status['last_error'] == 'None'):
return True
else:
LOG.debug('datasource %s not initialized, not polled, or shows '
'error. Full status: %s', datasource_name, ds_status)
return False
def _create_server(self, name, network):
keypair = self.create_keypair()
self.keypairs[keypair['name']] = keypair