Skip to content

Commit

Permalink
Fix skiptest on policyd
Browse files Browse the repository at this point in the history
The wrong approach was used.  It was supposed to be a raise rather than
just a cls call.  This PR fixes-up the SkipTest in policyd.
  • Loading branch information
ajkavanagh committed Oct 7, 2019
1 parent 0a33d4f commit 001635e
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions zaza/openstack/charm_tests/policyd/tests.py
Original file line number Diff line number Diff line change
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 001635e

Please sign in to comment.