Skip to content

Commit

Permalink
fix linting and test
Browse files Browse the repository at this point in the history
  • Loading branch information
gruebel committed Oct 14, 2023
1 parent 60dff0e commit 03bb735
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from checkov.common.models.enums import CheckCategories, CheckResult
from checkov.terraform.checks.resource.base_resource_value_check import BaseResourceValueCheck

Expand All @@ -18,8 +17,13 @@ def __init__(self) -> None:
id = "CKV_AZURE_227"
supported_resources = ("azurerm_kubernetes_cluster", "azurerm_kubernetes_cluster_node_pool")
categories = (CheckCategories.KUBERNETES,)
super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources,
missing_block_result=CheckResult.FAILED)
super().__init__(
name=name,
id=id,
categories=categories,
supported_resources=supported_resources,
missing_block_result=CheckResult.FAILED,
)

def get_inspected_key(self) -> str:
if self.entity_type == "azurerm_kubernetes_cluster":
Expand All @@ -28,5 +32,4 @@ def get_inspected_key(self) -> str:
return "enable_host_encryption"



check = AKSEncryptionAtHostEnabled()
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self) -> None:

def get_inspected_key(self) -> str:
return "default_node_pool/[0]/os_disk_type"

def get_expected_value(self) -> Any:
return "Ephemeral"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ def test(self):
'azurerm_kubernetes_cluster_node_pool.pass'
}
failing_resources = {
'azurerm_kubernetes_cluster.fail',
'azurerm_kubernetes_cluster.fail1',
'azurerm_kubernetes_cluster_node_pool.fail',
'azurerm_kubernetes_cluster.fail2',
'azurerm_kubernetes_cluster_node_pool.fail1',
'azurerm_kubernetes_cluster_node_pool.fail2',
}
skipped_resources = {}

passed_check_resources = set([c.resource for c in report.passed_checks])
failed_check_resources = set([c.resource for c in report.failed_checks])
passed_check_resources = {c.resource for c in report.passed_checks}
failed_check_resources = {c.resource for c in report.failed_checks}

self.assertEqual(summary['passed'], len(passing_resources))
self.assertEqual(summary['failed'], len(failing_resources))
Expand Down

0 comments on commit 03bb735

Please sign in to comment.