def test_full_name(self): self.config.runner.pcmk.load_agent( agent_name=self.name.full_name, agent_filename="resource_agent_ocf_heartbeat_dummy_utf8.xml", env={"PATH": "/usr/sbin:/bin:/usr/bin"}, ) self.assertEqual( lib.get_agent_metadata(self.env_assist.get_env(), self.name), self.agent_metadata, )
def test_agent_not_found(self): err_msg = "error message" self.config.runner.pcmk.load_agent( agent_name=self.name.full_name, agent_is_missing=True, stderr=err_msg, ) self.env_assist.assert_raise_library_error( lambda: lib.get_agent_metadata(self.env_assist.get_env(), self.name )) self.env_assist.assert_reports([ fixture.error( report_codes.UNABLE_TO_GET_AGENT_METADATA, agent=self.name.full_name, reason=err_msg, ) ], )
def test_metadata_load_error(self): self.config.runner.pcmk.load_agent( agent_is_missing=True, env={"PATH": "/usr/sbin:/bin:/usr/bin"}, ) self.env_assist.assert_raise_library_error( lambda: lib.get_agent_metadata(self.env_assist.get_env(), self.name )) self.env_assist.assert_reports([ fixture.error( report_codes.UNABLE_TO_GET_AGENT_METADATA, agent=self.name.full_name, reason=( f"Agent {self.name.full_name} not found or does not " "support meta-data: Invalid argument (22)\nMetadata " f"query for {self.name.full_name} failed: Input/output " "error"), ) ], )