Fix: redshift:DescribeClusterSnapshots should not raise ClusterNotFoundError
Real AWS backend returns an empty array instead of raising an error.
This commit is contained in:
parent
161cb46886
commit
555be78f6e
@ -777,7 +777,6 @@ class RedshiftBackend(BaseBackend):
|
||||
cluster_snapshots.append(snapshot)
|
||||
if cluster_snapshots:
|
||||
return cluster_snapshots
|
||||
raise ClusterNotFoundError(cluster_identifier)
|
||||
|
||||
if snapshot_identifier:
|
||||
if snapshot_identifier in self.snapshots:
|
||||
|
@ -826,12 +826,11 @@ def test_describe_cluster_snapshots():
|
||||
@mock_redshift
|
||||
def test_describe_cluster_snapshots_not_found_error():
|
||||
client = boto3.client("redshift", region_name="us-east-1")
|
||||
cluster_identifier = "my_cluster"
|
||||
snapshot_identifier = "my_snapshot"
|
||||
cluster_identifier = "non-existent-cluster-id"
|
||||
snapshot_identifier = "non-existent-snapshot-id"
|
||||
|
||||
client.describe_cluster_snapshots.when.called_with(
|
||||
ClusterIdentifier=cluster_identifier
|
||||
).should.throw(ClientError, "Cluster {} not found.".format(cluster_identifier))
|
||||
resp = client.describe_cluster_snapshots(ClusterIdentifier=cluster_identifier)
|
||||
resp["Snapshots"].should.have.length_of(0)
|
||||
|
||||
client.describe_cluster_snapshots.when.called_with(
|
||||
SnapshotIdentifier=snapshot_identifier
|
||||
|
Loading…
Reference in New Issue
Block a user