Skip to content

Commit

Permalink
RDS: add tests for availability zone presence
Browse files Browse the repository at this point in the history
  • Loading branch information
t3hG04T committed Aug 10, 2022
1 parent d18d910 commit 603000e
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/test_rds/test_rds.py
Original file line number Diff line number Diff line change
Expand Up @@ -2019,3 +2019,39 @@ def test_create_db_instance_with_tags():

resp = client.describe_db_instances(DBInstanceIdentifier=db_instance_identifier)
resp["DBInstances"][0]["TagList"].should.equal(tags)


@mock_rds
def test_create_db_instance_without_availability_zone():
region = "us-east-1"
client = boto3.client("rds", region_name=region)
db_instance_identifier = "test-db-instance"
resp = client.create_db_instance(
DBInstanceIdentifier=db_instance_identifier,
Engine="postgres",
DBName="staging-postgres",
DBInstanceClass="db.m1.small",
)
resp["DBInstance"]["AvailabilityZone"].should.contain(region)

resp = client.describe_db_instances(DBInstanceIdentifier=db_instance_identifier)
resp["DBInstances"][0]["AvailabilityZone"].should.contain(region)


@mock_rds
def test_create_db_instance_with_availability_zone():
region = "us-east-1"
availability_zone = f"{region}c"
client = boto3.client("rds", region_name=region)
db_instance_identifier = "test-db-instance"
resp = client.create_db_instance(
DBInstanceIdentifier=db_instance_identifier,
Engine="postgres",
DBName="staging-postgres",
DBInstanceClass="db.m1.small",
AvailabilityZone=availability_zone,
)
resp["DBInstance"]["AvailabilityZone"].should.equal(availability_zone)

resp = client.describe_db_instances(DBInstanceIdentifier=db_instance_identifier)
resp["DBInstances"][0]["AvailabilityZone"].should.equal(availability_zone)

0 comments on commit 603000e

Please sign in to comment.