Fix Health Check tests
Introduced a new configuration variable to set the supported health policy version that is used to help determine if we can run the health related tests. Change-Id: I025aada17db6900d3e4328d5c09890e4f260f4d6
This commit is contained in:
parent
e8c68ffb74
commit
44310b8364
|
@ -16,7 +16,6 @@ import os
|
|||
import signal
|
||||
from six.moves import BaseHTTPServer
|
||||
from six.moves import http_client as http
|
||||
from stevedore import extension
|
||||
import tempfile
|
||||
import tenacity
|
||||
|
||||
|
@ -42,19 +41,6 @@ def api_microversion(api_microversion):
|
|||
return decorator
|
||||
|
||||
|
||||
def is_policy_supported(policy_name_and_version):
|
||||
"""Check if specified policy is supported
|
||||
|
||||
:param policy_name_and_version: Combined string of policy name and version.
|
||||
E.g. senlin.policy.scaling-1.0
|
||||
:returns: True if policy_name_and_version is supported. False otherwise.
|
||||
"""
|
||||
mgr = extension.ExtensionManager(
|
||||
namespace='senlin.policies',
|
||||
invoke_on_load=False)
|
||||
return policy_name_and_version in mgr.names()
|
||||
|
||||
|
||||
def prepare_and_cleanup_for_nova_server(base, cidr, spec=None):
|
||||
keypair_name = create_a_keypair(base, is_admin_manager=False)
|
||||
if spec is None:
|
||||
|
|
|
@ -47,5 +47,8 @@ ClusteringGroup = [
|
|||
cfg.BoolOpt('delete_with_dependency',
|
||||
default=False,
|
||||
help="Enables tests that delete clusters with resources such "
|
||||
"as policies or receivers attached to it.")
|
||||
"as policies or receivers attached to it."),
|
||||
cfg.StrOpt('health_policy_version',
|
||||
default='1.0',
|
||||
help='Supported version of the health policy.'),
|
||||
]
|
||||
|
|
|
@ -10,18 +10,18 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from tempest import config
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as exc
|
||||
import testtools
|
||||
import time
|
||||
|
||||
from senlin_tempest_plugin.common import constants
|
||||
from senlin_tempest_plugin.common import utils
|
||||
from senlin_tempest_plugin.tests.functional import base
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
@testtools.skipUnless(utils.is_policy_supported('senlin.policy.health-1.1'),
|
||||
"senlin.policy.health-1.1 is not supported")
|
||||
class TestHealthPolicy(base.BaseSenlinFunctionalTest):
|
||||
def setUp(self):
|
||||
super(TestHealthPolicy, self).setUp()
|
||||
|
@ -33,6 +33,14 @@ class TestHealthPolicy(base.BaseSenlinFunctionalTest):
|
|||
desired_capacity=1)
|
||||
self.addCleanup(utils.delete_a_cluster, self, self.cluster_id)
|
||||
|
||||
@classmethod
|
||||
def skip_checks(cls):
|
||||
super(TestHealthPolicy, cls).skip_checks()
|
||||
if CONF.clustering.health_policy_version != '1.1':
|
||||
skip_msg = ("%s skipped as only Health Policy 1.1 is supported" %
|
||||
cls.__name__)
|
||||
raise cls.skipException(skip_msg)
|
||||
|
||||
@decorators.attr(type=['functional'])
|
||||
@decorators.idempotent_id('adfd813c-08c4-4650-9b66-a1a6e63b842e')
|
||||
def test_health_policy(self):
|
||||
|
|
|
@ -10,18 +10,18 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from tempest import config
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions
|
||||
import testtools
|
||||
import time
|
||||
|
||||
from senlin_tempest_plugin.common import constants
|
||||
from senlin_tempest_plugin.common import utils
|
||||
from senlin_tempest_plugin.tests.integration import base
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
@testtools.skipUnless(utils.is_policy_supported('senlin.policy.health-1.1'),
|
||||
"senlin.policy.health-1.1 is not supported")
|
||||
class TestHealthPolicy(base.BaseSenlinIntegrationTest):
|
||||
def setUp(self):
|
||||
super(TestHealthPolicy, self).setUp()
|
||||
|
@ -37,6 +37,14 @@ class TestHealthPolicy(base.BaseSenlinIntegrationTest):
|
|||
desired_capacity=1)
|
||||
self.addCleanup(utils.delete_a_cluster, self, self.cluster_id)
|
||||
|
||||
@classmethod
|
||||
def skip_checks(cls):
|
||||
super(TestHealthPolicy, cls).skip_checks()
|
||||
if CONF.clustering.health_policy_version != '1.1':
|
||||
skip_msg = ("%s skipped as only Health Policy 1.1 is supported" %
|
||||
cls.__name__)
|
||||
raise cls.skipException(skip_msg)
|
||||
|
||||
def _detach_policy(self, policy_id):
|
||||
# ignore BadRequest exceptions that are raised because
|
||||
# policy is not attached
|
||||
|
@ -80,6 +88,7 @@ class TestHealthPolicy(base.BaseSenlinIntegrationTest):
|
|||
|
||||
return list(nodes.keys())[index], list(nodes.values())[index]
|
||||
|
||||
@decorators.idempotent_id('52f34125-3d6e-4250-9d2e-b619a2905969')
|
||||
@decorators.attr(type=['integration'])
|
||||
def test_multiple_detection_modes_any(self):
|
||||
# Create a health policy
|
||||
|
|
Loading…
Reference in New Issue