Fixed tests failures when SKIP_ALL_TESTS_FOR_PLUGIN=True

Moved skipif statement to be called before SetUp function in tests for IDH2
and VANILLA_TWO plugins to avoid failures caused by call to
get_image_id_and_ssh_username function in SetUp function.
The fix makes test skipped instead of being failed.

Co-Authored-By: Sergey Reshetnyak <sreshetniak@mirantis.com>

Fixes bug: #1301273

Change-Id: I5e2f67b7dd48c268f62fe94374e96a61e85aff18
This commit is contained in:
skostiuchenkoHDP 2014-04-01 14:44:52 +03:00 committed by Sergey Reshetnyak
parent 6d07ceebef
commit 941d87562c
5 changed files with 26 additions and 23 deletions

View File

@ -14,7 +14,6 @@
# limitations under the License. # limitations under the License.
from testtools import testcase from testtools import testcase
import unittest2
from sahara.openstack.common import excutils from sahara.openstack.common import excutils
from sahara.tests.integration.configs import config as cfg from sahara.tests.integration.configs import config as cfg
@ -35,8 +34,8 @@ class HDPGatingTest(cinder.CinderVolumeTest, edp.EDPTest,
SKIP_SWIFT_TEST = config.SKIP_SWIFT_TEST SKIP_SWIFT_TEST = config.SKIP_SWIFT_TEST
SKIP_SCALING_TEST = config.SKIP_SCALING_TEST SKIP_SCALING_TEST = config.SKIP_SCALING_TEST
@unittest2.skipIf(config.SKIP_ALL_TESTS_FOR_PLUGIN, @testcase.skipIf(config.SKIP_ALL_TESTS_FOR_PLUGIN,
'All tests for HDP plugin were skipped') 'All tests for HDP plugin were skipped')
@testcase.attr('hdp') @testcase.attr('hdp')
def test_hdp_plugin_gating(self): def test_hdp_plugin_gating(self):
self.hdp_config.IMAGE_ID, self.hdp_config.SSH_USERNAME = ( self.hdp_config.IMAGE_ID, self.hdp_config.SSH_USERNAME = (

View File

@ -14,7 +14,6 @@
# limitations under the License. # limitations under the License.
from testtools import testcase from testtools import testcase
import unittest2
from sahara.tests.integration.configs import config as cfg from sahara.tests.integration.configs import config as cfg
from sahara.tests.integration.tests import base as b from sahara.tests.integration.tests import base as b
@ -36,7 +35,11 @@ class IDH2GatingTest(cluster_configs.ClusterConfigTest, edp.EDPTest,
def setUp(self): def setUp(self):
super(IDH2GatingTest, self).setUp() super(IDH2GatingTest, self).setUp()
self.cluster_id = None
self.cluster_template_id = None
self.ng_template_ids = []
def _prepare_test(self):
self.floating_ip_pool = self.common_config.FLOATING_IP_POOL self.floating_ip_pool = self.common_config.FLOATING_IP_POOL
self.internal_neutron_net = None self.internal_neutron_net = None
if self.common_config.NEUTRON_ENABLED: if self.common_config.NEUTRON_ENABLED:
@ -44,9 +47,6 @@ class IDH2GatingTest(cluster_configs.ClusterConfigTest, edp.EDPTest,
self.floating_ip_pool = \ self.floating_ip_pool = \
self.get_floating_ip_pool_id_for_neutron_net() self.get_floating_ip_pool_id_for_neutron_net()
self.cluster_id = None
self.cluster_template_id = None
self.ng_template_ids = []
self.idh2_config.IMAGE_ID, self.idh2_config.SSH_USERNAME = ( self.idh2_config.IMAGE_ID, self.idh2_config.SSH_USERNAME = (
self.get_image_id_and_ssh_username(self.idh2_config)) self.get_image_id_and_ssh_username(self.idh2_config))
@ -216,10 +216,12 @@ class IDH2GatingTest(cluster_configs.ClusterConfigTest, edp.EDPTest,
if not self.idh2_config.SKIP_SCALING_TEST: if not self.idh2_config.SKIP_SCALING_TEST:
self.check_swift_availability(self.cluster_info) self.check_swift_availability(self.cluster_info)
@unittest2.skipIf(cfg.ITConfig().idh2_config.SKIP_ALL_TESTS_FOR_PLUGIN, @testcase.skipIf(cfg.ITConfig().idh2_config.SKIP_ALL_TESTS_FOR_PLUGIN,
"All tests for Intel plugin were skipped") "All tests for Intel plugin were skipped")
@testcase.attr('idh2') @testcase.attr('idh2')
def test_idh_plugin_gating(self): def test_idh_plugin_gating(self):
self._prepare_test()
self._create_tt_dn_ng_template() self._create_tt_dn_ng_template()
self._create_tt_ng_template() self._create_tt_ng_template()
self._create_dn_ng_template() self._create_dn_ng_template()

View File

@ -14,7 +14,6 @@
# limitations under the License. # limitations under the License.
from testtools import testcase from testtools import testcase
import unittest2
from sahara.tests.integration.configs import config as cfg from sahara.tests.integration.configs import config as cfg
from sahara.tests.integration.tests import base from sahara.tests.integration.tests import base
@ -32,6 +31,11 @@ class IDH3GatingTest(swift.SwiftTest,
def setUp(self): def setUp(self):
super(IDH3GatingTest, self).setUp() super(IDH3GatingTest, self).setUp()
self.cluster_id = None
self.cluster_template_id = None
self.ng_template_ids = []
def _prepare_test(self):
self.idh3_config = cfg.ITConfig().idh3_config self.idh3_config = cfg.ITConfig().idh3_config
self.floating_ip_pool = self.common_config.FLOATING_IP_POOL self.floating_ip_pool = self.common_config.FLOATING_IP_POOL
self.internal_neutron_net = None self.internal_neutron_net = None
@ -40,9 +44,6 @@ class IDH3GatingTest(swift.SwiftTest,
self.floating_ip_pool = \ self.floating_ip_pool = \
self.get_floating_ip_pool_id_for_neutron_net() self.get_floating_ip_pool_id_for_neutron_net()
self.cluster_id = None
self.cluster_template_id = None
self.ng_template_ids = []
self.idh3_config.IMAGE_ID, self.idh3_config.SSH_USERNAME = ( self.idh3_config.IMAGE_ID, self.idh3_config.SSH_USERNAME = (
self.get_image_id_and_ssh_username(self.idh3_config)) self.get_image_id_and_ssh_username(self.idh3_config))
@ -202,10 +203,11 @@ class IDH3GatingTest(swift.SwiftTest,
if not self.idh3_config.SKIP_SCALING_TEST: if not self.idh3_config.SKIP_SCALING_TEST:
self.check_swift_availability(self.cluster_info) self.check_swift_availability(self.cluster_info)
@unittest2.skipIf(cfg.ITConfig().idh3_config.SKIP_ALL_TESTS_FOR_PLUGIN, @testcase.skipIf(cfg.ITConfig().idh3_config.SKIP_ALL_TESTS_FOR_PLUGIN,
"All tests for Intel plugin were skipped") "All tests for Intel plugin were skipped")
@testcase.attr('idh3') @testcase.attr('idh3')
def test_idh_plugin_gating(self): def test_idh_plugin_gating(self):
self._prepare_test()
self._create_tt_dn_ng_template() self._create_tt_dn_ng_template()
self._create_tt_ng_template() self._create_tt_ng_template()
self._create_dn_ng_template() self._create_dn_ng_template()

View File

@ -14,7 +14,6 @@
# limitations under the License. # limitations under the License.
from testtools import testcase from testtools import testcase
import unittest2
from sahara.openstack.common import excutils from sahara.openstack.common import excutils
from sahara.tests.integration.configs import config as cfg from sahara.tests.integration.configs import config as cfg
@ -41,8 +40,8 @@ class VanillaGatingTest(cinder.CinderVolumeTest,
SKIP_SCALING_TEST = config.SKIP_SCALING_TEST SKIP_SCALING_TEST = config.SKIP_SCALING_TEST
SKIP_TRANSIENT_CLUSTER_TEST = config.SKIP_TRANSIENT_CLUSTER_TEST SKIP_TRANSIENT_CLUSTER_TEST = config.SKIP_TRANSIENT_CLUSTER_TEST
@unittest2.skipIf(config.SKIP_ALL_TESTS_FOR_PLUGIN, @testcase.skipIf(config.SKIP_ALL_TESTS_FOR_PLUGIN,
'All tests for Vanilla plugin were skipped') 'All tests for Vanilla plugin were skipped')
@testcase.attr('vanilla1', 'transient') @testcase.attr('vanilla1', 'transient')
def test_vanilla_plugin_gating(self): def test_vanilla_plugin_gating(self):
self.vanilla_config.IMAGE_ID, self.vanilla_config.SSH_USERNAME = ( self.vanilla_config.IMAGE_ID, self.vanilla_config.SSH_USERNAME = (

View File

@ -14,7 +14,6 @@
# limitations under the License. # limitations under the License.
from testtools import testcase from testtools import testcase
import unittest2
from sahara.tests.integration.configs import config as cfg from sahara.tests.integration.configs import config as cfg
from sahara.tests.integration.tests import base as b from sahara.tests.integration.tests import base as b
@ -41,7 +40,11 @@ class VanillaTwoGatingTest(cluster_configs.ClusterConfigTest,
def setUp(self): def setUp(self):
super(VanillaTwoGatingTest, self).setUp() super(VanillaTwoGatingTest, self).setUp()
self.cluster_id = None
self.cluster_template_id = None
self.ng_template_ids = []
def _prepare_test(self):
self.vanilla_two_config = cfg.ITConfig().vanilla_two_config self.vanilla_two_config = cfg.ITConfig().vanilla_two_config
self.floating_ip_pool = self.common_config.FLOATING_IP_POOL self.floating_ip_pool = self.common_config.FLOATING_IP_POOL
self.internal_neutron_net = None self.internal_neutron_net = None
@ -50,9 +53,6 @@ class VanillaTwoGatingTest(cluster_configs.ClusterConfigTest,
self.floating_ip_pool = \ self.floating_ip_pool = \
self.get_floating_ip_pool_id_for_neutron_net() self.get_floating_ip_pool_id_for_neutron_net()
self.cluster_id = None
self.cluster_template_id = None
self.ng_template_ids = []
self.vanilla_two_config.IMAGE_ID, self.vanilla_two_config.SSH_USERNAME\ self.vanilla_two_config.IMAGE_ID, self.vanilla_two_config.SSH_USERNAME\
= (self.get_image_id_and_ssh_username(self.vanilla_two_config)) = (self.get_image_id_and_ssh_username(self.vanilla_two_config))
@ -278,11 +278,12 @@ class VanillaTwoGatingTest(cluster_configs.ClusterConfigTest,
def _check_edp_after_scaling(self): def _check_edp_after_scaling(self):
self._edp_test() self._edp_test()
@unittest2.skipIf( @testcase.skipIf(
cfg.ITConfig().vanilla_two_config.SKIP_ALL_TESTS_FOR_PLUGIN, cfg.ITConfig().vanilla_two_config.SKIP_ALL_TESTS_FOR_PLUGIN,
"All tests for Vanilla plugin were skipped") "All tests for Vanilla plugin were skipped")
@testcase.attr('vanilla2') @testcase.attr('vanilla2')
def test_vanilla_two_plugin_gating(self): def test_vanilla_two_plugin_gating(self):
self._prepare_test()
self._create_nm_dn_ng_template() self._create_nm_dn_ng_template()
self._create_nm_ng_template() self._create_nm_ng_template()
self._create_dn_ng_template() self._create_dn_ng_template()