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)
|
cluster_snapshots.append(snapshot)
|
||||||
if cluster_snapshots:
|
if cluster_snapshots:
|
||||||
return cluster_snapshots
|
return cluster_snapshots
|
||||||
raise ClusterNotFoundError(cluster_identifier)
|
|
||||||
|
|
||||||
if snapshot_identifier:
|
if snapshot_identifier:
|
||||||
if snapshot_identifier in self.snapshots:
|
if snapshot_identifier in self.snapshots:
|
||||||
|
@ -826,12 +826,11 @@ def test_describe_cluster_snapshots():
|
|||||||
@mock_redshift
|
@mock_redshift
|
||||||
def test_describe_cluster_snapshots_not_found_error():
|
def test_describe_cluster_snapshots_not_found_error():
|
||||||
client = boto3.client("redshift", region_name="us-east-1")
|
client = boto3.client("redshift", region_name="us-east-1")
|
||||||
cluster_identifier = "my_cluster"
|
cluster_identifier = "non-existent-cluster-id"
|
||||||
snapshot_identifier = "my_snapshot"
|
snapshot_identifier = "non-existent-snapshot-id"
|
||||||
|
|
||||||
client.describe_cluster_snapshots.when.called_with(
|
resp = client.describe_cluster_snapshots(ClusterIdentifier=cluster_identifier)
|
||||||
ClusterIdentifier=cluster_identifier
|
resp["Snapshots"].should.have.length_of(0)
|
||||||
).should.throw(ClientError, "Cluster {} not found.".format(cluster_identifier))
|
|
||||||
|
|
||||||
client.describe_cluster_snapshots.when.called_with(
|
client.describe_cluster_snapshots.when.called_with(
|
||||||
SnapshotIdentifier=snapshot_identifier
|
SnapshotIdentifier=snapshot_identifier
|
||||||
|
Loading…
x
Reference in New Issue
Block a user