зеркало из https://github.com/mozilla/frost.git
Add test to verify that all EIPs are bound to instances. (#331)
This commit is contained in:
Родитель
41bdffbd5e
Коммит
2748afc976
|
@ -269,6 +269,11 @@ def ec2_security_group_test_id(ec2_security_group):
|
||||||
return "{0[GroupId]} {0[GroupName]}".format(ec2_security_group)
|
return "{0[GroupId]} {0[GroupName]}".format(ec2_security_group)
|
||||||
|
|
||||||
|
|
||||||
|
def ec2_address_id(ec2_address):
|
||||||
|
"""Format an Elastic IP address."""
|
||||||
|
return ec2_address["PublicIp"]
|
||||||
|
|
||||||
|
|
||||||
def is_ebs_volume_encrypted(ebs):
|
def is_ebs_volume_encrypted(ebs):
|
||||||
"""
|
"""
|
||||||
Checks the EBS volume 'Encrypted' value.
|
Checks the EBS volume 'Encrypted' value.
|
||||||
|
|
|
@ -102,6 +102,16 @@ def ec2_vpcs():
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def ec2_addresses():
|
||||||
|
"https://botocore.readthedocs.io/en/latest/reference/services/ec2.html#EC2.Client.describe_addresses"
|
||||||
|
return (
|
||||||
|
botocore_client.get("ec2", "describe_addresses", [], {})
|
||||||
|
.extract_key("Addresses")
|
||||||
|
.flatten()
|
||||||
|
.values()
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def ec2_security_groups_with_in_use_flag():
|
def ec2_security_groups_with_in_use_flag():
|
||||||
"""Returns security groups with an additional "InUse" key,
|
"""Returns security groups with an additional "InUse" key,
|
||||||
which is True if it is associated with at least one resource.
|
which is True if it is associated with at least one resource.
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from aws.ec2.helpers import ec2_address_id
|
||||||
|
from aws.ec2.resources import ec2_addresses
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.ec2
|
||||||
|
@pytest.mark.parametrize("ec2_address", ec2_addresses(), ids=ec2_address_id)
|
||||||
|
def test_ec2_all_eips_bound(ec2_address):
|
||||||
|
"""Checks whether all EIPs are bound to instances."""
|
||||||
|
assert ec2_address.get("InstanceId"), "No associated instance."
|
Загрузка…
Ссылка в новой задаче