Fix: DeleteCluster behavior with SkipFinalClusterSnapshot
Original code was trying to raise a ClientError directly. Change to appropriate Redshift exception class. * Fix test assertion for `boto`. * Add test coverage for `boto3`.
This commit is contained in:
parent
555be78f6e
commit
49c6e65603
3 changed files with 83 additions and 6 deletions
|
|
@ -143,3 +143,10 @@ class ClusterAlreadyExistsFaultError(RedshiftClientError):
|
|||
super(ClusterAlreadyExistsFaultError, self).__init__(
|
||||
"ClusterAlreadyExists", "Cluster already exists"
|
||||
)
|
||||
|
||||
|
||||
class InvalidParameterCombinationError(RedshiftClientError):
|
||||
def __init__(self, message):
|
||||
super(InvalidParameterCombinationError, self).__init__(
|
||||
"InvalidParameterCombination", message
|
||||
)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import copy
|
|||
import datetime
|
||||
|
||||
from boto3 import Session
|
||||
from botocore.exceptions import ClientError
|
||||
|
||||
from moto.compat import OrderedDict
|
||||
from moto.core import BaseBackend, BaseModel, CloudFormationModel
|
||||
from moto.core.utils import iso_8601_datetime_with_milliseconds
|
||||
|
|
@ -17,6 +17,7 @@ from .exceptions import (
|
|||
ClusterSnapshotAlreadyExistsError,
|
||||
ClusterSnapshotNotFoundError,
|
||||
ClusterSubnetGroupNotFoundError,
|
||||
InvalidParameterCombinationError,
|
||||
InvalidParameterValueError,
|
||||
InvalidSubnetError,
|
||||
ResourceNotFoundFaultError,
|
||||
|
|
@ -655,10 +656,8 @@ class RedshiftBackend(BaseBackend):
|
|||
cluster_skip_final_snapshot is False
|
||||
and cluster_snapshot_identifer is None
|
||||
):
|
||||
raise ClientError(
|
||||
"InvalidParameterValue",
|
||||
"FinalSnapshotIdentifier is required for Snapshot copy "
|
||||
"when SkipFinalSnapshot is False",
|
||||
raise InvalidParameterCombinationError(
|
||||
"FinalClusterSnapshotIdentifier is required unless SkipFinalClusterSnapshot is specified."
|
||||
)
|
||||
elif (
|
||||
cluster_skip_final_snapshot is False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue