Skip to content

Commit 4fb1f2e

Browse files
committed
fix: copilot issues
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
1 parent 61bb452 commit 4fb1f2e

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

policies/cloud_custodian_resources_detected_test.rego

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,26 @@ test_violation_when_execution_error_detected if {
3434
}] with input as fixture
3535
}
3636

37+
test_violation_when_only_execution_errors_list_present if {
38+
fixture := {
39+
"check": {"name": "ec2-public-ip-check"},
40+
"execution": {
41+
"status": "error",
42+
"error": "",
43+
"errors": ["custodian execution failed"]
44+
},
45+
"result": {
46+
"resources": []
47+
}
48+
}
49+
50+
count(cloud_custodian_resources_detected.violation) == 1 with input as fixture
51+
52+
cloud_custodian_resources_detected.violation[{
53+
"remarks": "Cloud Custodian check \"ec2-public-ip-check\" failed during execution (status=\"error\"). error= errors=[\"custodian execution failed\"]"
54+
}] with input as fixture
55+
}
56+
3757
test_dynamic_title_and_description if {
3858
fixture := {
3959
"check": {"name": "ec2-public-ip-check"},
@@ -68,3 +88,16 @@ test_no_violation_when_no_resources if {
6888

6989
count(cloud_custodian_resources_detected.violation) == 0 with input as fixture
7090
}
91+
92+
test_violation_when_check_missing_uses_unknown_check if {
93+
fixture := {
94+
"execution": {"status": "success", "error": "", "errors": []},
95+
"result": {
96+
"resources": [{"InstanceId": "i-123"}]
97+
}
98+
}
99+
100+
cloud_custodian_resources_detected.violation[{
101+
"remarks": "Cloud Custodian check \"unknown-check\" matched 1 resource(s)."
102+
}] with input as fixture
103+
}

0 commit comments

Comments
 (0)