) from pcs.test.tools.pcs_unittest import TestCase empty_cib = rc("cib-empty.xml") temp_cib = rc("temp-cib.xml") # target-pattern attribute was added in pacemaker 1.1.13 with validate-with 2.3. # However in pcs this was implemented much later together with target-attribute # support. In that time pacemaker 1.1.12 was quite old. To keep tests simple we # do not run fencing topology tests on pacemaker older that 1.1.13 even if it # supports targeting by node names. skip_unless_fencing_level_supported = skip_unless_pacemaker_version( (1, 1, 13), "fencing levels") # target-attribute and target-value attributes were added in pacemaker 1.1.14 # with validate-with 2.4. fencing_level_attribute_supported = is_minimum_pacemaker_version(1, 1, 14) skip_unless_fencing_level_attribute_supported = skip_unless_pacemaker_version( (1, 1, 14), "fencing levels with attribute targets") class StonithDescribeTest(TestCase, AssertPcsMixin): def setUp(self): self.pcs_runner = PcsRunner(temp_cib) def test_success(self): self.assert_pcs_success("stonith describe fence_apc", stdout_start="""\ fence_apc - Fence agent for APC over telnet/ssh fence_apc is an I/O Fencing agent which can be used with the APC network power switch. It logs into device via telnet/ssh and reboots a specified outlet. Lengthy telnet/ssh connections should be avoided while a GFS cluster is running because the connection will block any necessary fencing actions.
from pcs.test.tools.misc import ( get_test_resource as rc, is_minimum_pacemaker_version, ) from pcs.test.tools.assertions import AssertPcsMixin from pcs.test.tools.pcs_runner import PcsRunner from pcs.test.tools import pcs_unittest as unittest old_cib = rc("cib-empty.xml") empty_cib = rc("cib-empty-2.5.xml") temp_cib = rc("temp-cib.xml") ALERTS_SUPPORTED = is_minimum_pacemaker_version(1, 1, 15) ALERTS_NOT_SUPPORTED_MSG = "Pacemaker version is too old (must be >= 1.1.15)" +\ " to test alerts" class PcsAlertTest(unittest.TestCase, AssertPcsMixin): def setUp(self): shutil.copy(empty_cib, temp_cib) self.pcs_runner = PcsRunner(temp_cib) @unittest.skipUnless(ALERTS_SUPPORTED, ALERTS_NOT_SUPPORTED_MSG) class AlertCibUpgradeTest(unittest.TestCase, AssertPcsMixin): def setUp(self): shutil.copy(old_cib, temp_cib) self.pcs_runner = PcsRunner(temp_cib)
) from pcs.test.tools.pcs_unittest import ( skipUnless, TestCase ) empty_cib = rc("cib-empty.xml") temp_cib = rc("temp-cib.xml") # target-pattern attribute was added in pacemaker 1.1.13 with validate-with 2.3. # However in pcs this was implemented much later together with target-attribute # support. In that time pacemaker 1.1.12 was quite old. To keep tests simple we # do not run fencing topology tests on pacemaker older that 1.1.13 even if it # supports targeting by node names. fencing_level_supported = is_minimum_pacemaker_version(1, 1, 13) fencing_level_not_supported_msg = ("Pacemaker version is too old " "(must be >= 1.1.13) to test fencing levels") # target-attribute and target-value attributes were added in pacemaker 1.1.14 # with validate-with 2.4. fencing_level_attribute_supported = is_minimum_pacemaker_version(1, 1, 14) fencing_level_attribute_not_supported_msg = ("Pacemaker version is too old " "(must be >= 1.1.14) to test fencing levels with attribute targets") class StonithDescribeTest(TestCase, AssertPcsMixin): def setUp(self): self.pcs_runner = PcsRunner(temp_cib) def test_success(self):