def test_manage_disabled_monitors(self): (self.config.runner.cib.load( resources=fixture_primitive_cib_unmanaged_op_disabled).env. push_cib(resources=fixture_primitive_cib_managed_op_disabled)) resource.manage(self.env_assist.get_env(), ["A"], False) self.env_assist.assert_reports([ fixture_report_no_monitors("A"), ])
def test_manage_disabled_monitors(self): self.assert_command_effect( fixture_primitive_cib_unmanaged_op_disabled, lambda: resource.manage(self.env, ["A"], False), fixture_primitive_cib_managed_op_disabled, [ fixture_report_no_monitors("A"), ])
def test_nonexistent_resource(self): self.runner.set_runs( fixture.call_cib_load( fixture.cib_resources(fixture_primitive_cib_unmanaged))) assert_raise_library_error(lambda: resource.manage(self.env, ["B"]), fixture.report_not_found("B", "resources")) self.runner.assert_everything_launched()
def test_nonexistent_resource(self): (self.config.runner.cib.load( resources=fixture_primitive_cib_unmanaged)) self.env_assist.assert_raise_library_error( lambda: resource.manage(self.env_assist.get_env(), ["B"]), [fixture.report_not_found("B", "resources")], expected_in_processor=False)
def test_bad_resource_enable(self): (self.config.runner.cib.load(resources=self.fixture_cib_unmanaged)) self.env_assist.assert_raise_library_error(lambda: resource.manage( self.env_assist.get_env(), ["B", "X", "Y", "A"]), [ fixture.report_not_found("X", "resources"), fixture.report_not_found("Y", "resources"), ], expected_in_processor=False)
def test_bundle(self): self.runner.set_runs( fixture.call_cib_load( fixture.cib_resources(fixture_bundle_cib_unmanaged_primitive))) assert_raise_library_error( lambda: resource.manage(self.env, ["A-bundle"], False), fixture.report_not_for_bundles("A-bundle")) self.runner.assert_everything_launched()
def test_success_manage(self): fixture_cib_managed = """ <resources> <primitive class="ocf" id="A" provider="heartbeat" type="Dummy"> </primitive> <primitive class="ocf" id="B" provider="heartbeat" type="Dummy"> <meta_attributes id="B-meta_attributes"> <nvpair id="B-meta_attributes-is-managed" name="is-managed" value="false" /> </meta_attributes> </primitive> <primitive class="ocf" id="C" provider="heartbeat" type="Dummy"> </primitive> </resources> """ (self.config.runner.cib.load( resources=self.fixture_cib_unmanaged).env.push_cib( resources=fixture_cib_managed)) resource.manage(self.env_assist.get_env(), ["A", "C"])
def test_bad_resource_enable(self): self.runner.set_runs( fixture.call_cib_load( fixture.cib_resources(self.fixture_cib_unmanaged))) assert_raise_library_error( lambda: resource.manage(self.env, ["B", "X", "Y", "A"]), fixture.report_not_found("X", "resources"), fixture.report_not_found("Y", "resources"), ) self.runner.assert_everything_launched()
def test_success_manage(self): fixture_cib_managed = """ <resources> <primitive class="ocf" id="A" provider="heartbeat" type="Dummy"> </primitive> <primitive class="ocf" id="B" provider="heartbeat" type="Dummy"> <meta_attributes id="B-meta_attributes"> <nvpair id="B-meta_attributes-is-managed" name="is-managed" value="false" /> </meta_attributes> </primitive> <primitive class="ocf" id="C" provider="heartbeat" type="Dummy"> </primitive> </resources> """ self.assert_command_effect( self.fixture_cib_unmanaged, lambda: resource.manage(self.env, ["A", "C"]), fixture_cib_managed)
def test_group_unmanaged_group(self): (self.config.runner.cib.load( resources=fixture_group_cib_unmanaged_resource_and_group).env. push_cib(resources=fixture_group_cib_managed)) resource.manage(self.env_assist.get_env(), ["A"])
def test_master_unmanaged_both(self): (self.config.runner.cib.load( resources=fixture_master_cib_unmanaged_both).env.push_cib( resources=fixture_master_cib_managed)) resource.manage(self.env_assist.get_env(), ["A-master"])
def test_primitive_unmanaged_both(self): self.assert_command_effect(fixture_clone_cib_unmanaged_both, lambda: resource.manage(self.env, ["A"]), fixture_clone_cib_managed)
def test_group_unmanaged_group(self): self.assert_command_effect( fixture_group_cib_unmanaged_resource_and_group, lambda: resource.manage(self.env, ["A"]), fixture_group_cib_managed)
def test_clone(self): self.assert_command_effect( fixture_clone_cib_unmanaged_clone, lambda: resource.manage(self.env, ["A-clone"]), fixture_clone_cib_managed)
def test_manage(self): (self.config.runner.cib.load( resources=fixture_primitive_cib_unmanaged_op_disabled).env. push_cib(resources=fixture_primitive_cib_managed_op_enabled)) resource.manage(self.env_assist.get_env(), ["A"], True)
def test_master_unmanaged_both(self): self.assert_command_effect( fixture_master_cib_unmanaged_both, lambda: resource.manage(self.env, ["A-master"]), fixture_master_cib_managed)
def test_primitive_unmanaged_master(self): self.assert_command_effect(fixture_master_cib_unmanaged_master, lambda: resource.manage(self.env, ["A"]), fixture_master_cib_managed)
def test_group(self): self.assert_command_effect( fixture_clone_group_cib_unmanaged_all_primitives, lambda: resource.manage(self.env, ["A"]), fixture_clone_group_cib_managed)
def test_primitive_unmanaged_both(self): (self.config.runner.cib.load( resources=fixture_bundle_cib_unmanaged_both).env.push_cib( resources=fixture_bundle_cib_managed)) resource.manage(self.env_assist.get_env(), ["A"])
def test_group(self): (self.config.runner.cib.load( resources=fixture_clone_group_cib_unmanaged_all_primitives).env. push_cib(resources=fixture_clone_group_cib_managed)) resource.manage(self.env_assist.get_env(), ["A"])
def test_clone_unmanaged_all(self): self.assert_command_effect( fixture_clone_group_cib_unmanaged_everything, lambda: resource.manage(self.env, ["A-clone"]), fixture_clone_group_cib_managed)
def test_primitive(self): self.assert_command_effect( fixture_bundle_cib_unmanaged_primitive, lambda: resource.manage(self.env, ["A"]), fixture_bundle_cib_managed, )
def test_clone_unmanaged_all(self): (self.config.runner.cib.load( resources=fixture_clone_group_cib_unmanaged_everything).env. push_cib(resources=fixture_clone_group_cib_managed)) resource.manage(self.env_assist.get_env(), ["A-clone"])
def test_manage(self): self.assert_command_effect( fixture_primitive_cib_unmanaged_op_disabled, lambda: resource.manage(self.env, ["A"], True), fixture_primitive_cib_managed_op_enabled)
def test_bundle_empty(self): (self.config.runner.cib.load( resources=fixture_bundle_empty_cib_unmanaged_bundle).env.push_cib( resources=fixture_bundle_empty_cib_managed)) resource.manage(self.env_assist.get_env(), ["A-bundle"])
def test_bundle_empty(self): self.assert_command_effect( fixture_bundle_empty_cib_unmanaged_bundle, lambda: resource.manage(self.env, ["A-bundle"]), fixture_bundle_empty_cib_managed )