Skip to content

Commit

Permalink
Merge pull request openstack-charmers#83 from ajkavanagh/fix-skip-pol…
Browse files Browse the repository at this point in the history
…icyd-check

Fix skiptest on policyd
  • Loading branch information
javacruft committed Oct 7, 2019
2 parents 0a33d4f + 001635e commit 3b6a511
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions zaza/openstack/charm_tests/policyd/tests.py
Expand Up @@ -35,6 +35,7 @@
import os
import shutil
import tempfile
import unittest
import zipfile

import keystoneauth1
Expand Down Expand Up @@ -65,9 +66,6 @@ class PolicydTest(object):
def setUpClass(cls, application_name=None):
"""Run class setup for running Policyd charm operation tests."""
super(PolicydTest, cls).setUpClass(application_name)
if (openstack_utils.get_os_release() <
openstack_utils.get_os_release('xenial_queens')):
cls.SkipTest("Test not valid before xenial_queens")
cls._tmp_dir = tempfile.mkdtemp()
cls._service_name = \
cls.test_config['tests_options']['policyd']['service']
Expand Down Expand Up @@ -194,7 +192,15 @@ def test_002_policyd_bad_yaml(self):
class GenericPolicydTest(PolicydTest, test_utils.OpenStackBaseTest):
"""Generic policyd test for any charm without a specific test."""

pass
@classmethod
def setUpClass(cls, application_name=None):
"""Run class setup for running KeystonePolicydTest tests."""
super(GenericPolicydTest, cls).setUpClass(application_name)
if (openstack_utils.get_os_release() <
openstack_utils.get_os_release('xenial_queens')):
raise unittest.SkipTest(
"zaza.openstack.charm_tests.policyd.tests.GenericPolicydTest "
"not valid before xenial_queens")


class PolicydOperationFailedException(Exception):
Expand Down Expand Up @@ -252,10 +258,16 @@ def get_client_and_attempt_operation(self, keystone_session):
def setUpClass(cls, application_name=None):
"""Run class setup for running KeystonePolicydTest tests."""
super(BasePolicydSpecialization, cls).setUpClass(application_name)
if (openstack_utils.get_os_release() <
openstack_utils.get_os_release('xenial_queens')):
raise unittest.SkipTest(
"zaza.openstack.charm_tests.policyd.tests.* "
"not valid before xenial_queens")
if cls._rule is None:
cls.SkipTest("Test not valid if {}.rule is not configured"
.format(cls.__name__))
return
raise unittest.SkipTest(
"zaza.openstack.charm_tests.policyd.tests.* "
"not valid if {}.rule is not configured"
.format(cls.__name__))

def get_client_and_attempt_operation(self, keystone_session):
"""Override this method to perform the operation.
Expand Down

0 comments on commit 3b6a511

Please sign in to comment.