Closed gliptak closed 4 years ago
https://travis-ci.com/gliptak/cloud-inquisitor/jobs/270949066
=================================== FAILURES ===================================
_______________________________ test_rds_generic _______________________________
cinq_test_service = <tests.service.service.CinqTestService object at 0x7fc26eb570f0>
def test_rds_generic(cinq_test_service):
"""
1. We will generate batch of compliant and non-compliant RDS resources, run the auditor and check if it works as
expected
2. We will make random non-compliant RDS instance meets the FIXED, STOP or REMOVE criteria and check if it works as
expected
"""
# Prep
setup_info = setup_test_aws(cinq_test_service)
recipient = setup_info['recipient']
account = setup_info['account']
compliant_resources = []
non_compliant_resources = []
prep_rds_testing(cinq_test_service)
# Add resources
num_resources = 50
for i in range(0, num_resources):
compliance_selector = random.randint(0, 1)
if compliance_selector:
tags = VALID_TAGS
else:
tags = {}
new_resource = create_resource(
resource_type=RDSInstance,
resource_id=uuid.uuid4().hex,
account_id=account.account_id,
properties={
'creation_date': datetime.datetime(2000, 1, 1),
'metrics': {},
'engine': 'mysql'
},
tags=tags,
auto_add=True,
auto_commit=True
)
if compliance_selector:
compliant_resources.append(new_resource.id)
else:
non_compliant_resources.append(new_resource.id)
# Initialize auditor
auditor = MockRequiredTagsAuditor()
> auditor.run(enable_process_action=False)
/opt/cinq/backend/tests/test_cinq_auditor_aws_required_tags_rds.py:60:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/cinq/backend/tests/libs/cinq_test_cls.py:27: in run
super().run(args, kwargs)
/opt/cinq/plugins/public/cinq-auditor-required-tags/cinq_auditor_required_tags/__init__.py:111: in run
known_issues, new_issues, fixed_issues = self.get_resources()
/opt/cinq/plugins/public/cinq-auditor-required-tags/cinq_auditor_required_tags/__init__.py:156: in get_resources
found_issues = self.get_known_resources_missing_tags()
/opt/cinq/plugins/public/cinq-auditor-required-tags/cinq_auditor_required_tags/__init__.py:140: in get_known_resources_missing_tags
missing_tags, notes = self.check_required_tags_compliance(resource)
/opt/cinq/plugins/public/cinq-auditor-required-tags/cinq_auditor_required_tags/__init__.py:491: in check_required_tags_compliance
notes.append('Instance name = {}'.format(resource.instance_name))
/opt/cinq/backend/cloud_inquisitor/plugins/types/resources.py:34: in __getattr__
return self.get_property(item)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <cloud_inquisitor.plugins.types.resources.RDSInstance object at 0x7fc26e7706a0>
name = 'instance_name'
def get_property(self, name):
"""Return a named property for a resource, if available. Will raise an `AttributeError` if the property
does not exist
Args:
name (str): Name of the property to return
Returns:
`ResourceProperty`
"""
for prop in self.resource.properties:
if prop.name == name:
return prop
> raise AttributeError(name)
E AttributeError: instance_name
/opt/cinq/backend/cloud_inquisitor/plugins/types/resources.py:324: AttributeError
___________________________ test_rds_corrupted_data ____________________________
cinq_test_service = <tests.service.service.CinqTestService object at 0x7fc26e973630>
def test_rds_corrupted_data(cinq_test_service):
# Prep
se
recipient = setup_info['recipient']
account = setup_info['account']
auditor = MockRequiredTagsAuditor()
new_resource = create_resource(
resource_type=RDSInstance,
resource_id=uuid.uuid4().hex,
account_id=account.account_id,
properties={},
tags={},
auto_add=True,
auto_commit=True
)
> auditor.run(enable_process_action=False)
/opt/cinq/backend/tests/test_cinq_auditor_aws_required_tags_rds.py:136:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/cinq/backend/tests/libs/cinq_test_cls.py:27: in run
super().run(args, kwargs)
/opt/cinq/plugins/public/cinq-auditor-required-tags/cinq_auditor_required_tags/__init__.py:111: in run
known_issues, new_issues, fixed_issues = self.get_resources()
/opt/cinq/plugins/public/cinq-auditor-required-tags/cinq_auditor_required_tags/__init__.py:156: in get_resources
found_issues = self.get_known_resources_missing_tags()
/opt/cinq/plugins/public/cinq-auditor-required-tags/cinq_auditor_required_tags/__init__.py:140: in get_known_resources_missing_tags
missin
g_tags, notes = self.check_required_tags_compliance(resource)
/opt/cinq/plugins/public/cinq-auditor-required-tags/cinq_auditor_required_tags/__init__.py:491: in check_required_tags_compliance
notes.append('Instance name = {}'.format(resource.instance_name))
/opt/cinq/backend/cloud_inquisitor/plugins/types/resources.py:34: in __getattr__
return self.get_property(item)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <cloud_inquisitor.plugins.types.resources.RDSInstance object at 0x7fc26fd9e470>
name = 'instance_name'
def get_property(self, name):
"""Return a named property for a resource, if available. Will raise an `AttributeError` if the property
does not exist
Args:
name (str): Name of the property to return
Returns:
`ResourceProperty`
"""
for prop in self.resource.properties:
if prop.name == name:
return prop
> raise AttributeError(name)
E AttributeError: instance_name
/opt/cinq/backend/cloud_inquisitor/plugins/types/resources.py:324: AttributeError
=============================== warnings summary ===============================
tests/test_cinq_auditor_aws_required_tags_e2e.py::test_volume_ec2_s3
@riotgames please review
Signed-off-by: Gábor Lipták gliptak@gmail.com