From 74e3454418b80d95e20e5ea2721828316c5ceead Mon Sep 17 00:00:00 2001 From: Vitaly Date: Sun, 29 Sep 2024 15:12:16 +0300 Subject: [PATCH 1/3] fix --- .../resource_dome9_image_assurance_policy_test.go | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/dome9/resource_dome9_image_assurance_policy_test.go b/dome9/resource_dome9_image_assurance_policy_test.go index 659b1ac5..3818120f 100644 --- a/dome9/resource_dome9_image_assurance_policy_test.go +++ b/dome9/resource_dome9_image_assurance_policy_test.go @@ -60,21 +60,6 @@ func TestAccResourceImagePolicyPolicyBasic(t *testing.T) { resource.TestCheckResourceAttr(policyTypeAndName, "target_type", variable.ImageAssurancePolicyTargetType), ), }, - { - // Update Policy Test Step from Detection to Prevention - Config: testCheckImageAssurancePolicyBasic(imageAssurancePolicyUpdatedHCL, policyGeneratedName, policyTypeAndName), - Check: resource.ComposeTestCheckFunc( - testCheckImageAssurancePolicyExists(policyTypeAndName, &response), - resource.TestCheckResourceAttr(policyTypeAndName, "admission_control_action", variable.ImageAssurancePolicyPreventAction), - resource.TestCheckResourceAttr(policyTypeAndName, "admission_control_unscanned_action", variable.ImageAssurancePolicyPreventAction), - resource.TestCheckResourceAttrSet(policyTypeAndName, "id"), - resource.TestCheckResourceAttr(policyTypeAndName, "notification_ids.#", "1"), - resource.TestCheckResourceAttrSet(policyTypeAndName, "notification_ids.0"), - resource.TestCheckResourceAttr(policyTypeAndName, "ruleset_id", strconv.Itoa(variable.ImageAssurancePolicyDefaultRulesetId)), - resource.TestCheckResourceAttrSet(policyTypeAndName, "target_id"), - resource.TestCheckResourceAttr(policyTypeAndName, "target_type", variable.ImageAssurancePolicyTargetType), - ), - }, }, }) } From 6512d7060b7d50f813bb84dffa8dca5345957e01 Mon Sep 17 00:00:00 2001 From: Vitaly Date: Sun, 29 Sep 2024 15:14:08 +0300 Subject: [PATCH 2/3] test --- ...ource_dome9_image_assurance_policy_test.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/dome9/resource_dome9_image_assurance_policy_test.go b/dome9/resource_dome9_image_assurance_policy_test.go index 3818120f..bc2c3a53 100644 --- a/dome9/resource_dome9_image_assurance_policy_test.go +++ b/dome9/resource_dome9_image_assurance_policy_test.go @@ -36,8 +36,8 @@ func TestAccResourceImagePolicyPolicyBasic(t *testing.T) { // Generate Image Assurance Policy HCL Resource imageAssurancePolicyHCL := getImageAssurancePolicyResourceHCL(kubernetesAccountHCL, kubernetesAccountResourceTypeAndName, notificationHCL, notificationTypeAndName, policyGeneratedName, false) - imageAssurancePolicyUpdatedHCL := getImageAssurancePolicyResourceHCL(kubernetesAccountHCL, kubernetesAccountResourceTypeAndName, notificationHCL, - notificationTypeAndName, policyGeneratedName, true) + // imageAssurancePolicyUpdatedHCL := getImageAssurancePolicyResourceHCL(kubernetesAccountHCL, kubernetesAccountResourceTypeAndName, notificationHCL, + // notificationTypeAndName, policyGeneratedName, true) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) @@ -60,6 +60,21 @@ func TestAccResourceImagePolicyPolicyBasic(t *testing.T) { resource.TestCheckResourceAttr(policyTypeAndName, "target_type", variable.ImageAssurancePolicyTargetType), ), }, + // { + // // Update Policy Test Step from Detection to Prevention + // Config: testCheckImageAssurancePolicyBasic(imageAssurancePolicyUpdatedHCL, policyGeneratedName, policyTypeAndName), + // Check: resource.ComposeTestCheckFunc( + // testCheckImageAssurancePolicyExists(policyTypeAndName, &response), + // resource.TestCheckResourceAttr(policyTypeAndName, "admission_control_action", variable.ImageAssurancePolicyPreventAction), + // resource.TestCheckResourceAttr(policyTypeAndName, "admission_control_unscanned_action", variable.ImageAssurancePolicyPreventAction), + // resource.TestCheckResourceAttrSet(policyTypeAndName, "id"), + // resource.TestCheckResourceAttr(policyTypeAndName, "notification_ids.#", "1"), + // resource.TestCheckResourceAttrSet(policyTypeAndName, "notification_ids.0"), + // resource.TestCheckResourceAttr(policyTypeAndName, "ruleset_id", strconv.Itoa(variable.ImageAssurancePolicyDefaultRulesetId)), + // resource.TestCheckResourceAttrSet(policyTypeAndName, "target_id"), + // resource.TestCheckResourceAttr(policyTypeAndName, "target_type", variable.ImageAssurancePolicyTargetType), + // ), + // }, }, }) } From 08b006f0efebbfad0570863926a2ad906ce41da6 Mon Sep 17 00:00:00 2001 From: Vitaly Date: Sun, 29 Sep 2024 15:58:16 +0300 Subject: [PATCH 3/3] revert change --- ...ource_dome9_image_assurance_policy_test.go | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/dome9/resource_dome9_image_assurance_policy_test.go b/dome9/resource_dome9_image_assurance_policy_test.go index bc2c3a53..ff7a6191 100644 --- a/dome9/resource_dome9_image_assurance_policy_test.go +++ b/dome9/resource_dome9_image_assurance_policy_test.go @@ -36,8 +36,9 @@ func TestAccResourceImagePolicyPolicyBasic(t *testing.T) { // Generate Image Assurance Policy HCL Resource imageAssurancePolicyHCL := getImageAssurancePolicyResourceHCL(kubernetesAccountHCL, kubernetesAccountResourceTypeAndName, notificationHCL, notificationTypeAndName, policyGeneratedName, false) - // imageAssurancePolicyUpdatedHCL := getImageAssurancePolicyResourceHCL(kubernetesAccountHCL, kubernetesAccountResourceTypeAndName, notificationHCL, - // notificationTypeAndName, policyGeneratedName, true) + imageAssurancePolicyUpdatedHCL := getImageAssurancePolicyResourceHCL(kubernetesAccountHCL, kubernetesAccountResourceTypeAndName, notificationHCL, + notificationTypeAndName, policyGeneratedName, true) + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) @@ -60,21 +61,21 @@ func TestAccResourceImagePolicyPolicyBasic(t *testing.T) { resource.TestCheckResourceAttr(policyTypeAndName, "target_type", variable.ImageAssurancePolicyTargetType), ), }, - // { - // // Update Policy Test Step from Detection to Prevention - // Config: testCheckImageAssurancePolicyBasic(imageAssurancePolicyUpdatedHCL, policyGeneratedName, policyTypeAndName), - // Check: resource.ComposeTestCheckFunc( - // testCheckImageAssurancePolicyExists(policyTypeAndName, &response), - // resource.TestCheckResourceAttr(policyTypeAndName, "admission_control_action", variable.ImageAssurancePolicyPreventAction), - // resource.TestCheckResourceAttr(policyTypeAndName, "admission_control_unscanned_action", variable.ImageAssurancePolicyPreventAction), - // resource.TestCheckResourceAttrSet(policyTypeAndName, "id"), - // resource.TestCheckResourceAttr(policyTypeAndName, "notification_ids.#", "1"), - // resource.TestCheckResourceAttrSet(policyTypeAndName, "notification_ids.0"), - // resource.TestCheckResourceAttr(policyTypeAndName, "ruleset_id", strconv.Itoa(variable.ImageAssurancePolicyDefaultRulesetId)), - // resource.TestCheckResourceAttrSet(policyTypeAndName, "target_id"), - // resource.TestCheckResourceAttr(policyTypeAndName, "target_type", variable.ImageAssurancePolicyTargetType), - // ), - // }, + { + // Update Policy Test Step from Detection to Prevention + Config: testCheckImageAssurancePolicyBasic(imageAssurancePolicyUpdatedHCL, policyGeneratedName, policyTypeAndName), + Check: resource.ComposeTestCheckFunc( + testCheckImageAssurancePolicyExists(policyTypeAndName, &response), + resource.TestCheckResourceAttr(policyTypeAndName, "admission_control_action", variable.ImageAssurancePolicyPreventAction), + resource.TestCheckResourceAttr(policyTypeAndName, "admission_control_unscanned_action", variable.ImageAssurancePolicyPreventAction), + resource.TestCheckResourceAttrSet(policyTypeAndName, "id"), + resource.TestCheckResourceAttr(policyTypeAndName, "notification_ids.#", "1"), + resource.TestCheckResourceAttrSet(policyTypeAndName, "notification_ids.0"), + resource.TestCheckResourceAttr(policyTypeAndName, "ruleset_id", strconv.Itoa(variable.ImageAssurancePolicyDefaultRulesetId)), + resource.TestCheckResourceAttrSet(policyTypeAndName, "target_id"), + resource.TestCheckResourceAttr(policyTypeAndName, "target_type", variable.ImageAssurancePolicyTargetType), + ), + }, }, }) }