Updating SkipTest() with error messages

Change-Id: I1d11bd25f9d40c2f9289bd4c68f00aca04ff4733
Closes-Bug: #1515601
This commit is contained in:
Maksym Strukov 2016-04-27 15:49:02 +03:00
parent a3279ef7e9
commit 75c35894a2
10 changed files with 91 additions and 100 deletions

View File

@ -85,7 +85,8 @@ class TestBasic(object):
"""
if snapshot_name:
if self.env.d_env.has_snapshot(snapshot_name):
raise SkipTest()
raise SkipTest('Snapshot {} already exist'.format(
snapshot_name))
def show_step(self, step, details='', initialize=False):
"""Show a description of the step taken from docstring

View File

@ -28,6 +28,8 @@ from fuelweb_test.tests.test_os_upgrade import TestOSupgrade
@test(groups=["clone_env_for_os_upgrade", "os_upgrade"])
class TestCloneEnv(base_test_case.TestBasic):
snapshot = 'upgrade_ha_ceph_for_all_ubuntu_neutron_vlan'
@test(
depends_on=[TestOSupgrade.upgrade_ha_ceph_for_all_ubuntu_neutron_vlan],
groups=["test_clone_environment"])
@ -42,11 +44,9 @@ class TestCloneEnv(base_test_case.TestBasic):
"""
if not self.env.d_env.has_snapshot(
"upgrade_ha_ceph_for_all_ubuntu_neutron_vlan"):
raise SkipTest()
self.env.revert_snapshot("upgrade_ha_ceph_for_all_ubuntu_neutron_vlan",
skip_timesync=True)
if not self.env.d_env.has_snapshot(self.snapshot):
raise SkipTest('Snapshot {} not found'.format(self.snapshot))
self.env.revert_snapshot(self.snapshot, skip_timesync=True)
cluster_id = self.fuel_web.get_last_created_cluster()
cluster = self.fuel_web.client.get_cluster(cluster_id)
@ -127,11 +127,9 @@ class TestCloneEnv(base_test_case.TestBasic):
3. Check status code
"""
if not self.env.d_env.has_snapshot(
"upgrade_ha_ceph_for_all_ubuntu_neutron_vlan"):
raise SkipTest()
self.env.revert_snapshot("upgrade_ha_ceph_for_all_ubuntu_neutron_vlan",
skip_timesync=True)
if not self.env.d_env.has_snapshot(self.snapshot):
raise SkipTest('Snapshot {} not found'.format(self.snapshot))
self.env.revert_snapshot(self.snapshot, skip_timesync=True)
data = {
"name": "new_test_cluster",
@ -156,11 +154,9 @@ class TestCloneEnv(base_test_case.TestBasic):
3. Check status code
"""
if not self.env.d_env.has_snapshot(
"upgrade_ha_ceph_for_all_ubuntu_neutron_vlan"):
raise SkipTest()
self.env.revert_snapshot("upgrade_ha_ceph_for_all_ubuntu_neutron_vlan",
skip_timesync=True)
if not self.env.d_env.has_snapshot(self.snapshot):
raise SkipTest('Snapshot {} not found'.format(self.snapshot))
self.env.revert_snapshot(self.snapshot, skip_timesync=True)
cluster_id = self.fuel_web.get_last_created_cluster()
cluster = self.fuel_web.client.get_cluster(cluster_id)
@ -190,11 +186,9 @@ class TestCloneEnv(base_test_case.TestBasic):
3. Check status code
"""
if not self.env.d_env.has_snapshot(
"upgrade_ha_ceph_for_all_ubuntu_neutron_vlan"):
raise SkipTest()
self.env.revert_snapshot("upgrade_ha_ceph_for_all_ubuntu_neutron_vlan",
skip_timesync=True)
if not self.env.d_env.has_snapshot(self.snapshot):
raise SkipTest('Snapshot {} not found'.format(self.snapshot))
self.env.revert_snapshot(self.snapshot, skip_timesync=True)
cluster_id = self.fuel_web.get_last_created_cluster()
@ -221,11 +215,9 @@ class TestCloneEnv(base_test_case.TestBasic):
3. Check status code
"""
if not self.env.d_env.has_snapshot(
"upgrade_ha_ceph_for_all_ubuntu_neutron_vlan"):
raise SkipTest()
self.env.revert_snapshot("upgrade_ha_ceph_for_all_ubuntu_neutron_vlan",
skip_timesync=True)
if not self.env.d_env.has_snapshot(self.snapshot):
raise SkipTest('Snapshot {} not found'.format(self.snapshot))
self.env.revert_snapshot(self.snapshot, skip_timesync=True)
cluster_id = self.fuel_web.get_last_created_cluster()
@ -249,11 +241,9 @@ class TestCloneEnv(base_test_case.TestBasic):
3. Check status code
"""
if not self.env.d_env.has_snapshot(
"upgrade_ha_ceph_for_all_ubuntu_neutron_vlan"):
raise SkipTest()
self.env.revert_snapshot("upgrade_ha_ceph_for_all_ubuntu_neutron_vlan",
skip_timesync=True)
if not self.env.d_env.has_snapshot(self.snapshot):
raise SkipTest('Snapshot {} not found'.format(self.snapshot))
self.env.revert_snapshot(self.snapshot, skip_timesync=True)
cluster_id = self.fuel_web.get_last_created_cluster()
@ -282,11 +272,9 @@ class TestCloneEnv(base_test_case.TestBasic):
3. Check status code
"""
if not self.env.d_env.has_snapshot(
"upgrade_ha_ceph_for_all_ubuntu_neutron_vlan"):
raise SkipTest()
self.env.revert_snapshot("upgrade_ha_ceph_for_all_ubuntu_neutron_vlan",
skip_timesync=True)
if not self.env.d_env.has_snapshot(self.snapshot):
raise SkipTest('Snapshot {} not found'.format(self.snapshot))
self.env.revert_snapshot(self.snapshot, skip_timesync=True)
cluster_id = self.fuel_web.get_last_created_cluster()
@ -316,11 +304,9 @@ class TestCloneEnv(base_test_case.TestBasic):
"""
if not self.env.d_env.has_snapshot(
"upgrade_ha_ceph_for_all_ubuntu_neutron_vlan"):
raise SkipTest()
self.env.revert_snapshot("upgrade_ha_ceph_for_all_ubuntu_neutron_vlan",
skip_timesync=True)
if not self.env.d_env.has_snapshot(self.snapshot):
raise SkipTest('Snapshot {} not found'.format(self.snapshot))
self.env.revert_snapshot(self.snapshot, skip_timesync=True)
cluster_id = self.fuel_web.get_last_created_cluster()
cluster = self.fuel_web.client.get_cluster(cluster_id)

View File

@ -76,7 +76,7 @@ class TestMultipleClusterNets(TestNetworkTemplatesBase):
"""
if not MULTIPLE_NETWORKS:
raise SkipTest()
raise SkipTest('MULTIPLE_NETWORKS not enabled')
self.show_step(1, initialize=True)
self.env.revert_snapshot("ready")
@ -413,7 +413,7 @@ class TestMultipleClusterNets(TestNetworkTemplatesBase):
"""
if not MULTIPLE_NETWORKS:
raise SkipTest()
raise SkipTest('MULTIPLE_NETWORKS not enabled')
self.show_step(1, initialize=True)
self.env.revert_snapshot("ready")
@ -528,7 +528,7 @@ class TestMultipleClusterNets(TestNetworkTemplatesBase):
"""
if not MULTIPLE_NETWORKS:
raise SkipTest()
raise SkipTest('MULTIPLE_NETWORKS not enabled')
self.show_step(1, initialize=True)
self.check_run("deploy_controllers_from_custom_nodegroup")

View File

@ -29,6 +29,8 @@ from fuelweb_test.tests.test_os_upgrade import TestOSupgrade
@test(groups=["reassign_node_for_os_upgrade", "os_upgrade"])
class TestReassignNode(base_test_case.TestBasic):
snapshot = 'upgrade_ha_ceph_for_all_ubuntu_neutron_vlan'
@test(
depends_on=[TestOSupgrade.upgrade_ha_ceph_for_all_ubuntu_neutron_vlan],
groups=["reassign_node_to_cloned_environment"])
@ -43,10 +45,9 @@ class TestReassignNode(base_test_case.TestBasic):
5. Wait node successful provision
"""
if not self.env.d_env.has_snapshot(
"upgrade_ha_ceph_for_all_ubuntu_neutron_vlan"):
raise SkipTest()
self.env.revert_snapshot("upgrade_ha_ceph_for_all_ubuntu_neutron_vlan")
if not self.env.d_env.has_snapshot(self.snapshot):
raise SkipTest('Snapshot {} not found'.format(self.snapshot))
self.env.revert_snapshot(self.snapshot)
cluster_id = self.fuel_web.get_last_created_cluster()
cluster = self.fuel_web.client.get_cluster(cluster_id)
@ -123,10 +124,9 @@ class TestReassignNode(base_test_case.TestBasic):
3. Check status code: 404
"""
if not self.env.d_env.has_snapshot(
"upgrade_ha_ceph_for_all_ubuntu_neutron_vlan"):
raise SkipTest()
self.env.revert_snapshot("upgrade_ha_ceph_for_all_ubuntu_neutron_vlan")
if not self.env.d_env.has_snapshot(self.snapshot):
raise SkipTest('Snapshot {} not found'.format(self.snapshot))
self.env.revert_snapshot(self.snapshot)
cluster_id = self.fuel_web.get_last_created_cluster()
@ -161,10 +161,9 @@ class TestReassignNode(base_test_case.TestBasic):
4. Check status code: 400
"""
if not self.env.d_env.has_snapshot(
"upgrade_ha_ceph_for_all_ubuntu_neutron_vlan"):
raise SkipTest()
self.env.revert_snapshot("upgrade_ha_ceph_for_all_ubuntu_neutron_vlan")
if not self.env.d_env.has_snapshot(self.snapshot):
raise SkipTest('Snapshot {} not found'.format(self.snapshot))
self.env.revert_snapshot(self.snapshot)
cluster_id = self.fuel_web.get_last_created_cluster()
cluster = self.fuel_web.client.get_cluster(cluster_id)
@ -201,10 +200,9 @@ class TestReassignNode(base_test_case.TestBasic):
4. Check status code: 400
"""
if not self.env.d_env.has_snapshot(
"upgrade_ha_ceph_for_all_ubuntu_neutron_vlan"):
raise SkipTest()
self.env.revert_snapshot("upgrade_ha_ceph_for_all_ubuntu_neutron_vlan")
if not self.env.d_env.has_snapshot(self.snapshot):
raise SkipTest('Snapshot {} not found'.format(self.snapshot))
self.env.revert_snapshot(self.snapshot)
cluster_id = self.fuel_web.get_last_created_cluster()
cluster = self.fuel_web.client.get_cluster(cluster_id)
@ -245,10 +243,9 @@ class TestReassignNode(base_test_case.TestBasic):
4. Check status code: 404
"""
if not self.env.d_env.has_snapshot(
"upgrade_ha_ceph_for_all_ubuntu_neutron_vlan"):
raise SkipTest()
self.env.revert_snapshot("upgrade_ha_ceph_for_all_ubuntu_neutron_vlan")
if not self.env.d_env.has_snapshot(self.snapshot):
raise SkipTest('Snapshot {} not found'.format(self.snapshot))
self.env.revert_snapshot(self.snapshot)
cluster_id = self.fuel_web.get_last_created_cluster()
cluster = self.fuel_web.client.get_cluster(cluster_id)

View File

@ -48,7 +48,7 @@ class PrepareOSupgrade(base_test_case.TestBasic):
Snapshot ha_ceph_for_all_ubuntu_neutron_vlan
"""
if settings.OPENSTACK_RELEASE_UBUNTU not in settings.OPENSTACK_RELEASE:
raise SkipTest()
raise SkipTest('Openstack release is not Ubuntu')
self.check_run('ha_ceph_for_all_ubuntu_neutron_vlan')
self.env.revert_snapshot("ready_with_9_slaves")
@ -103,7 +103,7 @@ class TestOSupgrade(base_test_case.TestBasic):
"""
if settings.OPENSTACK_RELEASE_UBUNTU not in settings.OPENSTACK_RELEASE:
raise SkipTest()
raise SkipTest('Openstack release is not Ubuntu')
self.check_run('upgrade_ha_ceph_for_all_ubuntu_neutron_vlan')
self.env.revert_snapshot('ha_ceph_for_all_ubuntu_neutron_vlan')
@ -140,7 +140,7 @@ class TestOSupgrade(base_test_case.TestBasic):
"""
if settings.OPENSTACK_RELEASE_UBUNTU not in settings.OPENSTACK_RELEASE:
raise SkipTest()
raise SkipTest('Openstack release is not Ubuntu')
self.check_run('prepare_before_os_upgrade')
self.env.revert_snapshot("upgrade_ha_ceph_for_all_ubuntu_neutron_vlan")
@ -171,7 +171,7 @@ class TestOSupgrade(base_test_case.TestBasic):
"""
if settings.OPENSTACK_RELEASE_UBUNTU not in settings.OPENSTACK_RELEASE:
raise SkipTest()
raise SkipTest('Openstack release is not Ubuntu')
self.check_run('os_upgrade_env')
self.env.revert_snapshot("prepare_before_os_upgrade")
@ -203,7 +203,7 @@ class TestOSupgrade(base_test_case.TestBasic):
"""
if settings.OPENSTACK_RELEASE_UBUNTU not in settings.OPENSTACK_RELEASE:
raise SkipTest()
raise SkipTest('Openstack release is not Ubuntu')
self.check_run('upgrade_first_cic')
self.env.revert_snapshot("os_upgrade_env")
@ -246,7 +246,7 @@ class TestOSupgrade(base_test_case.TestBasic):
"""
if settings.OPENSTACK_RELEASE_UBUNTU not in settings.OPENSTACK_RELEASE:
raise SkipTest()
raise SkipTest('Openstack release is not Ubuntu')
self.check_run('upgrade_db')
self.env.revert_snapshot("upgrade_first_cic")
@ -330,7 +330,7 @@ class TestOSupgrade(base_test_case.TestBasic):
"""
if settings.OPENSTACK_RELEASE_UBUNTU not in settings.OPENSTACK_RELEASE:
raise SkipTest()
raise SkipTest('Openstack release is not Ubuntu')
self.check_run('upgrade_ceph')
self.env.revert_snapshot("upgrade_db")
@ -374,7 +374,7 @@ class TestOSupgrade(base_test_case.TestBasic):
"""
if settings.OPENSTACK_RELEASE_UBUNTU not in settings.OPENSTACK_RELEASE:
raise SkipTest()
raise SkipTest('Openstack release is not Ubuntu')
self.check_run('upgrade_control_plane')
self.env.revert_snapshot("upgrade_ceph")

View File

@ -333,7 +333,7 @@ class UbuntuBootstrap(base_test_case.TestBasic):
Duration 45m
"""
if not self.env.revert_snapshot('ready'):
raise SkipTest()
raise SkipTest('Required snapshot not found')
uuid = self.env.fuel_bootstrap_actions.get_active_bootstrap_uuid()
@ -410,7 +410,7 @@ class UbuntuBootstrap(base_test_case.TestBasic):
"""
if not self.env.revert_snapshot('ready_with_3_slaves'):
raise SkipTest()
raise SkipTest('Required snapshot not found')
def check_node(ssh_manager_executor, ip):
cmd = 'grep bootstrap /etc/hostname'
@ -514,7 +514,7 @@ class UbuntuBootstrap(base_test_case.TestBasic):
if not self.env.revert_snapshot(
'deploy_stop_on_deploying_ubuntu_bootstrap'):
raise SkipTest()
raise SkipTest('Required snapshot not found')
cluster_id = self.fuel_web.get_last_created_cluster()
@ -555,7 +555,7 @@ class UbuntuBootstrap(base_test_case.TestBasic):
"""
if not self.env.revert_snapshot(
'deploy_stop_on_deploying_ubuntu_bootstrap'):
raise SkipTest()
raise SkipTest('Required snapshot not found')
cluster_id = self.fuel_web.get_last_created_cluster()
@ -595,7 +595,7 @@ class UbuntuBootstrap(base_test_case.TestBasic):
"""
if not self.env.revert_snapshot(
'deploy_stop_on_deploying_ubuntu_bootstrap'):
raise SkipTest()
raise SkipTest('Required snapshot not found')
cluster_id = self.fuel_web.get_last_created_cluster()

View File

@ -126,7 +126,7 @@ class TestHaFailoverBase(TestBasic):
def ha_destroy_controllers(self):
if not self.env.d_env.has_snapshot(self.snapshot_name):
raise SkipTest()
raise SkipTest('Snapshot {} not found'.format(self.snapshot_name))
def get_needed_controllers(cluster_id):
n_ctrls = self.fuel_web.get_nailgun_cluster_nodes_by_roles(
@ -200,7 +200,7 @@ class TestHaFailoverBase(TestBasic):
def ha_disconnect_controllers(self):
if not self.env.revert_snapshot(self.snapshot_name):
raise SkipTest()
raise SkipTest('Snapshot {} not found'.format(self.snapshot_name))
cluster_id = self.fuel_web.client.get_cluster_id(
self.__class__.__name__)
@ -228,7 +228,7 @@ class TestHaFailoverBase(TestBasic):
def ha_delete_vips(self):
if not self.env.d_env.has_snapshot(self.snapshot_name):
raise SkipTest()
raise SkipTest('Snapshot {} not found'.format(self.snapshot_name))
logger.debug('Start reverting of {0} snapshot'
.format(self.snapshot_name))
@ -336,7 +336,7 @@ class TestHaFailoverBase(TestBasic):
def ha_mysql_termination(self):
if not self.env.d_env.has_snapshot(self.snapshot_name):
raise SkipTest()
raise SkipTest('Snapshot {} not found'.format(self.snapshot_name))
self.env.revert_snapshot(self.snapshot_name)
cluster_id = self.fuel_web.client.get_cluster_id(
@ -372,7 +372,7 @@ class TestHaFailoverBase(TestBasic):
def ha_haproxy_termination(self):
if not self.env.d_env.has_snapshot(self.snapshot_name):
raise SkipTest()
raise SkipTest('Snapshot {} not found'.format(self.snapshot_name))
self.env.revert_snapshot(self.snapshot_name)
@ -425,7 +425,7 @@ class TestHaFailoverBase(TestBasic):
def ha_pacemaker_configuration(self):
if not self.env.d_env.has_snapshot(self.snapshot_name):
raise SkipTest()
raise SkipTest('Snapshot {} not found'.format(self.snapshot_name))
self.env.revert_snapshot(self.snapshot_name)
@ -469,7 +469,7 @@ class TestHaFailoverBase(TestBasic):
def ha_pacemaker_restart_heat_engine(self):
if not self.env.d_env.has_snapshot(self.snapshot_name):
raise SkipTest()
raise SkipTest('Snapshot {} not found'.format(self.snapshot_name))
self.env.revert_snapshot(self.snapshot_name)
ocf_success = "DEBUG: OpenStack Orchestration Engine" \
@ -540,7 +540,7 @@ class TestHaFailoverBase(TestBasic):
def ha_check_monit(self):
if not self.env.d_env.has_snapshot(self.snapshot_name):
raise SkipTest()
raise SkipTest('Snapshot {} not found'.format(self.snapshot_name))
self.env.revert_snapshot(self.snapshot_name)
cluster_id = self.fuel_web.client.get_cluster_id(
@ -566,7 +566,7 @@ class TestHaFailoverBase(TestBasic):
def check_firewall_vulnerability(self):
if not self.env.d_env.has_snapshot(self.snapshot_name):
raise SkipTest()
raise SkipTest('Snapshot {} not found'.format(self.snapshot_name))
self.env.revert_snapshot(self.snapshot_name)
cluster_id = self.fuel_web.get_last_created_cluster()
@ -574,7 +574,7 @@ class TestHaFailoverBase(TestBasic):
def check_virtual_router(self):
if not self.env.d_env.has_snapshot(self.snapshot_name):
raise SkipTest()
raise SkipTest('Snapshot {} not found'.format(self.snapshot_name))
self.env.revert_snapshot(self.snapshot_name)
cluster_id = self.fuel_web.get_last_created_cluster()
@ -637,7 +637,7 @@ class TestHaFailoverBase(TestBasic):
def ha_controller_loss_packages(self, dev='br-mgmt', loss_percent='0.05'):
if not self.env.d_env.has_snapshot(self.snapshot_name):
raise SkipTest()
raise SkipTest('Snapshot {} not found'.format(self.snapshot_name))
self.env.revert_snapshot(self.snapshot_name)
@ -682,7 +682,7 @@ class TestHaFailoverBase(TestBasic):
def ha_sequential_rabbit_master_failover(self):
if not self.env.d_env.has_snapshot(self.snapshot_name):
raise SkipTest()
raise SkipTest('Snapshot {} not found'.format(self.snapshot_name))
self.env.revert_snapshot(self.snapshot_name)
@ -859,7 +859,7 @@ class TestHaFailoverBase(TestBasic):
def check_alive_rabbit_node_not_kicked(self):
if not self.env.d_env.has_snapshot(self.snapshot_name):
raise SkipTest()
raise SkipTest('Snapshot {} not found'.format(self.snapshot_name))
self.env.revert_snapshot(self.snapshot_name)
@ -940,7 +940,7 @@ class TestHaFailoverBase(TestBasic):
def check_dead_rabbit_node_kicked(self):
if not self.env.d_env.has_snapshot(self.snapshot_name):
raise SkipTest()
raise SkipTest('Snapshot {} not found'.format(self.snapshot_name))
self.env.revert_snapshot(self.snapshot_name)
@ -1020,7 +1020,7 @@ class TestHaFailoverBase(TestBasic):
def test_3_1_rabbit_failover(self):
if not self.env.d_env.has_snapshot(self.snapshot_name):
raise SkipTest()
raise SkipTest('Snapshot {} not found'.format(self.snapshot_name))
logger.info('Revert environment started...')
self.env.revert_snapshot(self.snapshot_name)
@ -1202,7 +1202,7 @@ class TestHaFailoverBase(TestBasic):
return True
if not self.env.d_env.has_snapshot(self.snapshot_name):
raise SkipTest()
raise SkipTest('Snapshot {} not found'.format(self.snapshot_name))
self.env.revert_snapshot(self.snapshot_name)
p_d_ctrl = self.fuel_web.get_nailgun_primary_node(
@ -1324,7 +1324,7 @@ class TestHaFailoverBase(TestBasic):
def ha_rabbitmq_stability_check(self):
if not self.env.d_env.has_snapshot(self.snapshot_name):
raise SkipTest()
raise SkipTest('Snapshot {} not found'.format(self.snapshot_name))
logger.info('Revert environment started...')
self.show_step(1, initialize=True)
self.env.revert_snapshot(self.snapshot_name)

View File

@ -115,7 +115,7 @@ class GateOstf(TestBasic):
self.show_step(1, initialize=True)
if not self.env.revert_snapshot(
'gate_ostf_ceph_ha'):
raise SkipTest()
raise SkipTest('Snapshot gate_ostf_ceph_ha not found')
self.show_step(2)
update_ostf()
cluster_id = self.fuel_web.get_last_created_cluster()

View File

@ -305,7 +305,9 @@ class BaseActions(PrepareActions, HealthCheckActions, PluginsActions):
"""
if self.cluster_id is None:
raise SkipTest()
raise SkipTest(
"The cluster_id is not specified, can not add node to cluster"
)
self._add_node(self.env_config['nodes'])
@ -318,7 +320,9 @@ class BaseActions(PrepareActions, HealthCheckActions, PluginsActions):
"""
if self.cluster_id is None:
raise SkipTest()
raise SkipTest(
"The cluster_id is not specified, can not run the deploy"
)
self.fuel_web.deploy_cluster_wait(self.cluster_id)
@ -327,7 +331,9 @@ class BaseActions(PrepareActions, HealthCheckActions, PluginsActions):
def stop_on_deploy(self):
"""Stop environment deploying and wait while slave bacame online"""
if self.cluster_id is None:
raise SkipTest()
raise SkipTest(
"The cluster_id is not specified, can not stop the deploy"
)
cluster_id = self.cluster_id
self.fuel_web.deploy_cluster_wait_progress(cluster_id, progress=60)
@ -345,7 +351,8 @@ class BaseActions(PrepareActions, HealthCheckActions, PluginsActions):
"""
if self.cluster_id is None:
raise SkipTest()
raise SkipTest("The cluster_id is not specified, "
"can not run network verification")
self.fuel_web.verify_network(self.cluster_id)

View File

@ -269,7 +269,7 @@ class VMwareActions(object):
def deploy_changes(self):
"""Deploy environment"""
if self.cluster_id is None:
raise SkipTest()
raise SkipTest("The cluster_id is not specified, can not deploy")
self.fuel_web.deploy_cluster_wait(self.cluster_id,
check_services=False)