RDS modify-db-instance: raise DBParameterGroupNotFoundError if the DBParameterGroupName does not exist (#4879)
This commit is contained in:
parent
c53dc4c21c
commit
e3fc799b95
@ -455,6 +455,12 @@ class Database(CloudFormationModel):
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
|
if (
|
||||||
|
self.db_parameter_group_name
|
||||||
|
not in rds2_backends[self.region].db_parameter_groups
|
||||||
|
):
|
||||||
|
raise DBParameterGroupNotFoundError(self.db_parameter_group_name)
|
||||||
|
|
||||||
return [
|
return [
|
||||||
rds2_backends[self.region].db_parameter_groups[
|
rds2_backends[self.region].db_parameter_groups[
|
||||||
self.db_parameter_group_name
|
self.db_parameter_group_name
|
||||||
|
@ -396,6 +396,27 @@ def test_modify_db_instance():
|
|||||||
].should.equal("sg-123456")
|
].should.equal("sg-123456")
|
||||||
|
|
||||||
|
|
||||||
|
@mock_rds2
|
||||||
|
def test_modify_db_instance_not_existent_db_parameter_group_name():
|
||||||
|
conn = boto3.client("rds", region_name="us-west-2")
|
||||||
|
conn.create_db_instance(
|
||||||
|
DBInstanceIdentifier="db-master-1",
|
||||||
|
AllocatedStorage=10,
|
||||||
|
DBInstanceClass="postgres",
|
||||||
|
Engine="db.m1.small",
|
||||||
|
MasterUsername="root",
|
||||||
|
MasterUserPassword="hunter2",
|
||||||
|
Port=1234,
|
||||||
|
DBSecurityGroups=["my_sg"],
|
||||||
|
)
|
||||||
|
instances = conn.describe_db_instances(DBInstanceIdentifier="db-master-1")
|
||||||
|
instances["DBInstances"][0]["AllocatedStorage"].should.equal(10)
|
||||||
|
conn.modify_db_instance.when.called_with(
|
||||||
|
DBInstanceIdentifier="db-master-1",
|
||||||
|
DBParameterGroupName="test-sqlserver-se-2017",
|
||||||
|
).should.throw(ClientError)
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds2
|
||||||
def test_rename_db_instance():
|
def test_rename_db_instance():
|
||||||
conn = boto3.client("rds", region_name="us-west-2")
|
conn = boto3.client("rds", region_name="us-west-2")
|
||||||
|
Loading…
Reference in New Issue
Block a user