コード例 #1
0
 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"),
     ])
コード例 #2
0
 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"),
         ])
コード例 #3
0
    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()
コード例 #4
0
    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)
コード例 #5
0
    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)
コード例 #6
0
    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()
コード例 #7
0
 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"])
コード例 #8
0
    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()
コード例 #9
0
 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)
コード例 #10
0
 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"])
コード例 #11
0
 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"])
コード例 #12
0
 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)
コード例 #13
0
 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)
コード例 #14
0
 def test_clone(self):
     self.assert_command_effect(
         fixture_clone_cib_unmanaged_clone,
         lambda: resource.manage(self.env, ["A-clone"]),
         fixture_clone_cib_managed)
コード例 #15
0
 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)
コード例 #16
0
 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)
コード例 #17
0
 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)
コード例 #18
0
 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)
コード例 #19
0
 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"])
コード例 #20
0
 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"])
コード例 #21
0
 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)
コード例 #22
0
 def test_primitive(self):
     self.assert_command_effect(
         fixture_bundle_cib_unmanaged_primitive,
         lambda: resource.manage(self.env, ["A"]),
         fixture_bundle_cib_managed,
     )
コード例 #23
0
 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"])
コード例 #24
0
 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)
コード例 #25
0
 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"])
コード例 #26
0
 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
     )