in critter/stack.py [0:0]
def validate_config_evaluation(self):
logger.info(f"Validating Config rule '{self.config_rule_name}' evaluation results")
print() # printing a blank line for console output readability
failed_resource_ids = []
for resource_id, resource in self.resources.items():
resource_type = resource["resource_type"]
expected = resource["expected_compliance_type"]
actual = resource["evaluation_result"]["ComplianceType"]
# TODO: test for expected annotation values
if expected == actual:
emoji = "\u2705"
else:
emoji = "\u274c"
failed_resource_ids.append(resource_id)
try:
annotation = resource["evaluation_result"]["Annotation"]
except KeyError:
annotation = "<None>"
logger.warning(
f"{emoji}\tResource type: {resource_type}\n\tResource id: {resource_id}\n"
f"\tExpected: {expected}\n\tActual: {actual}\n\tAnnotation: {annotation}"
)
print() # printing a blank line for console output readability
if failed_resource_ids:
raise TestFailure(f"Failed resource ids: {failed_resource_ids}")