def assert_running_info_transform(self, run_info, report): self.get_primitives_for_state_check.return_value = ["elem1", "elem2"] self.get_primitive_roles_with_nodes.return_value = run_info assert_report_item_equal( state.info_resource_state(self.cluster_state, self.resource_id), report) self.get_primitives_for_state_check.assert_called_once_with( self.cluster_state, self.resource_id, expected_running=True) self.get_primitive_roles_with_nodes.assert_called_once_with( ["elem1", "elem2"])
def test_code_other(self): assert_report_item_equal( lib.response_to_report_item(self.fixture_response_connected(500)), ( severity.ERROR, report_codes.NODE_COMMUNICATION_ERROR, { "node": self.host, "command": self.request, "reason": "HTTP error: 500" }, None ) )
def test_code_404(self): assert_report_item_equal( lib.response_to_report_item(self.fixture_response_connected(404)), ( severity.ERROR, report_codes.NODE_COMMUNICATION_ERROR_UNSUPPORTED_COMMAND, { "node": self.host, "command": self.request, "reason": "HTTP error: 404" }, None ) )
def test_code_403(self): assert_report_item_equal( lib.response_to_report_item(self.fixture_response_connected(403)), ( severity.ERROR, report_codes.NODE_COMMUNICATION_ERROR_PERMISSION_DENIED, { "node": self.host, "command": self.request, "reason": "HTTP error: 403" }, None ) )
def test_code_400(self): assert_report_item_equal( lib.response_to_report_item(self.fixture_response_connected(400)), ( severity.ERROR, report_codes.NODE_COMMUNICATION_COMMAND_UNSUCCESSFUL, { "node": self.host, "command": self.request, "reason": self.data.decode("utf-8") }, None ) )
def test_code_401(self): assert_report_item_equal( lib.response_to_report_item(self.fixture_response_connected(401)), ( severity.ERROR, report_codes.NODE_COMMUNICATION_ERROR_NOT_AUTHORIZED, { "node": self.host, "command": self.request, "reason": "HTTP error: 401", }, None, ), )
def test_unable_to_connect(self): response = self.fixture_response_not_connected(pycurl.E_SEND_ERROR, "err") assert_report_item_equal( lib.response_to_report_item(response), ( severity.ERROR, report_codes.NODE_COMMUNICATION_ERROR_UNABLE_TO_CONNECT, { "node": self.host, "command": self.request, "reason": "err" }, None, ), )
def test_timedouted(self): response = self.fixture_response_not_connected( pycurl.E_OPERATION_TIMEOUTED, "err") assert_report_item_equal( lib.response_to_report_item(response), ( severity.ERROR, report_codes.NODE_COMMUNICATION_ERROR_TIMED_OUT, { "node": self.host, "command": self.request, "reason": "err" }, None, ), )
def test_unable_to_connect(self): response = self.fixture_response_not_connected( pycurl.E_SEND_ERROR, "err" ) assert_report_item_equal( lib.response_to_report_item(response), ( severity.ERROR, report_codes.NODE_COMMUNICATION_ERROR_UNABLE_TO_CONNECT, { "node": self.host, "command": self.request, "reason": "err" }, None ) )
def test_timedouted(self): response = self.fixture_response_not_connected( pycurl.E_OPERATION_TIMEOUTED, "err" ) assert_report_item_equal( lib.response_to_report_item(response), ( severity.ERROR, report_codes.NODE_COMMUNICATION_ERROR_TIMED_OUT, { "node": self.host, "command": self.request, "reason": "err" }, None ) )