예제 #1
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()
예제 #2
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()
예제 #3
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()
예제 #4
0
 def test_bundle_doesnt_exist(self):
     self.runner.set_runs(fixture_agent_load_calls() +
                          fixture.call_cib_load(
                              fixture.cib_resources(
                                  self.fixture_empty_resources,
                                  self.upgraded_cib,
                              )))
     assert_raise_library_error(
         self.simplest_create,
         (severities.ERROR, report_codes.ID_NOT_FOUND, {
             "id": "B",
             "id_description": "bundle",
             "context_type": "resources",
             "context_id": "",
         }))
예제 #5
0
 def test_id_not_bundle(self):
     resources_pre_update = """<resources>
         <primitive id="B"/>
     </resources>"""
     self.runner.set_runs(fixture_agent_load_calls() +
                          fixture.call_cib_load(
                              fixture.cib_resources(
                                  resources_pre_update,
                                  self.upgraded_cib,
                              )))
     assert_raise_library_error(
         self.simplest_create,
         (severities.ERROR, report_codes.ID_BELONGS_TO_UNEXPECTED_TYPE, {
             "id": "B",
             "expected_types": ["bundle"],
             "current_type": "primitive",
         }))
예제 #6
0
 def test_bundle_not_empty(self):
     resources_pre_update = """<resources>
         <bundle id="B">
             <primitive id="P"/>
         </bundle>
     </resources>"""
     self.runner.set_runs(fixture_agent_load_calls() +
                          fixture.call_cib_load(
                              fixture.cib_resources(
                                  resources_pre_update,
                                  self.upgraded_cib,
                              )))
     assert_raise_library_error(
         self.simplest_create,
         (severities.ERROR,
          report_codes.RESOURCE_BUNDLE_ALREADY_CONTAINS_A_RESOURCE, {
              "bundle_id": "B",
              "resource_id": "P",
          }))
예제 #7
0
 def fixture_cib_resources(self, cib):
     return fixture.cib_resources(cib, cib_base_file=self.cib_base_file)