def test_supported(self): stonith_el, report_list = stonith.validate_stonith_restartless_update( self.RESOURCES, "supported" ) self.assertEqual( stonith_el, self.RESOURCES.find(".//primitive[@id='supported']") ) assert_report_item_list_equal(report_list, [])
def test_not_a_resource_id(self): stonith_el, report_list = stonith.validate_stonith_restartless_update( self.RESOURCES, "empty-instance_attributes-devices") self.assertEqual(stonith_el, None) assert_report_item_list_equal( report_list, [ fixture.error( reports.codes.ID_BELONGS_TO_UNEXPECTED_TYPE, id="empty-instance_attributes-devices", expected_types=["primitive"], current_type="nvpair", ) ], )
def test_nonexistent_id(self): stonith_el, report_list = stonith.validate_stonith_restartless_update( self.RESOURCES, "non-existent") self.assertEqual(stonith_el, None) assert_report_item_list_equal( report_list, [ fixture.error( reports.codes.ID_NOT_FOUND, id="non-existent", expected_types=["primitive"], context_type="resources", context_id="", ) ], )
def assert_no_devices(self, resource_id): stonith_el, report_list = stonith.validate_stonith_restartless_update( self.RESOURCES, resource_id) self.assertEqual( stonith_el, self.RESOURCES.find(f".//primitive[@id='{resource_id}']"), ) assert_report_item_list_equal( report_list, [ fixture.error( reports.codes.STONITH_RESTARTLESS_UPDATE_UNABLE_TO_PERFORM, reason=("no devices option configured for stonith device " f"'{resource_id}'"), reason_type="other", ) ], )
def assert_unsupported_stonith_agent(self, resource_id, resource_type): stonith_el, report_list = stonith.validate_stonith_restartless_update( self.RESOURCES, resource_id) self.assertEqual( stonith_el, self.RESOURCES.find(f".//primitive[@id='{resource_id}']"), ) assert_report_item_list_equal( report_list, [ fixture.error( reports.codes.STONITH_RESTARTLESS_UPDATE_UNSUPPORTED_AGENT, resource_id=resource_id, resource_type=resource_type, supported_stonith_types=["fence_scsi", "fence_mpath"], ) ], )