def test_success(self): (self.config.runner.pcmk.load_state( nodes=[fixture.state_node(i, f"name_{i}") for i in range(1, 4)]).runner.pcmk.local_node_name( node_name="name_2")) env = self.env_assist.get_env() real_status = lib.get_local_node_status(env.cmd_runner()) self.assertEqual( dict(offline=False, **fixture.state_node("2", "name_2")), real_status)
def test_error_getting_node_name(self): (self.config.runner.pcmk.load_state( nodes=[fixture.state_node(i, f"name_{i}") for i in range(1, 4)]).runner.pcmk.local_node_name( stdout="some info", stderr="some error", returncode=1)) env = self.env_assist.get_env() self.env_assist.assert_raise_library_error( lambda: lib.get_local_node_status(env.cmd_runner()), [ fixture.error(report_codes.PACEMAKER_LOCAL_NODE_NAME_NOT_FOUND, force_code=None, reason="some error\nsome info") ], expected_in_processor=False)
def test_node_not_in_status(self): (self.config.runner.pcmk.load_state( nodes=[fixture.state_node(i, f"name_{i}") for i in range(1, 4)]).runner.pcmk.local_node_name( node_name="name_X")) env = self.env_assist.get_env() self.env_assist.assert_raise_library_error( lambda: lib.get_local_node_status(env.cmd_runner()), [ fixture.error(report_codes.NODE_NOT_FOUND, force_code=None, node="name_X", searched_types=[]) ], expected_in_processor=False)