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_validation(self): resources_before = """ <resources> <group id="G"> <primitive id="RG1" /> </group> <primitive id="R1"> <meta_attributes id="R1-meta_attributes" /> </primitive> <primitive id="R2"> <meta_attributes id="R2-meta_attributes" /> </primitive> <clone id="RC1-clone"> <primitive id="RC1" /> </clone> </resources> """ (self.config.runner.cib.load(resources=resources_before)) self.env_assist.assert_raise_library_error( lambda: resource.group_add( self.env_assist.get_env(), "R1-meta_attributes", ["R2", "R4", "R3", "R2-meta_attributes", "RC1-clone", "RC1"]), [ fixture.error( report_codes.ID_BELONGS_TO_UNEXPECTED_TYPE, id="R1-meta_attributes", expected_types=["group"], current_type="meta_attributes", ), fixture.report_not_found("R4", context_type="resources"), fixture.report_not_found("R3", context_type="resources"), fixture.error( report_codes.ID_BELONGS_TO_UNEXPECTED_TYPE, id="R2-meta_attributes", expected_types=[ "clone", "master", "group", "primitive", "bundle" ], current_type="meta_attributes", ), fixture.error( report_codes.CANNOT_GROUP_RESOURCE_WRONG_TYPE, resource_id="RC1-clone", resource_type="clone", ), fixture.error( report_codes.CANNOT_GROUP_RESOURCE_WRONG_TYPE, resource_id="RC1", resource_type="clone", ), ], )
def test_nonexistent_resource(self): (self.config.runner.cib.load(resources=fixture_primitive_cib_managed)) self.env_assist.assert_raise_library_error( lambda: resource.unmanage(self.env_assist.get_env(), ["B"]), [fixture.report_not_found("B", "resources")], expected_in_processor=False)
def test_missing_resources_specified(self): assert_report_item_list_equal(self._validate("G", ["RX1", "RX2"]), [ fixture.report_not_found("RX1", context_type="resources"), fixture.report_not_found("RX2", context_type="resources"), ])