Exemple #1
0
 def status_proto(self):
     return status_pb2.Status(status_code=self.proto_status_code,
                              error_message=str(self))
Exemple #2
0
@patch(
    "bentoml.yatai.deployment.aws_ec2.operator.ensure_sam_available_or_raise",
    MagicMock(),
)
@patch(
    "bentoml.yatai.deployment.aws_ec2.operator.ensure_docker_available_or_raise",
    MagicMock(),
)
@patch(
    "bentoml.yatai.deployment.aws_ec2.operator.AwsEc2DeploymentOperator.deploy_service",
    MagicMock(),
)
@patch(
    "bentoml.yatai.deployment.aws_ec2.operator.AwsEc2DeploymentOperator.describe",
    MagicMock(return_value=DescribeDeploymentResponse(status=status_pb2.Status(
        status_code=status_pb2.Status.INTERNAL, error_message="failed"))),
)
def test_ec2_update_describe_failure():
    yatai_service_mock = create_yatai_service_mock()
    test_deployment_pb = generate_ec2_deployment_pb()
    operator = AwsEc2DeploymentOperator(yatai_service_mock)

    result_pb = operator.update(test_deployment_pb, test_deployment_pb)
    assert result_pb.status.status_code == status_pb2.Status.INTERNAL
    assert result_pb.deployment.state.state == DeploymentState.ERROR


@patch(
    "bentoml.yatai.deployment.aws_ec2.operator.ensure_sam_available_or_raise",
    MagicMock(),
)