Skip to content

Commit

Permalink
Change ExpectedError in TestAccComputeInstanceNetworkIntefaceWithSecu…
Browse files Browse the repository at this point in the history
  • Loading branch information
karolgorc authored Sep 16, 2024
1 parent c90e258 commit bd193c6
Showing 1 changed file with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3361,11 +3361,11 @@ func TestAccComputeInstance_proactiveAttributionLabel(t *testing.T) {
}

<% unless version == 'ga' -%>
const errorDeleteAccessConfigWithSecPolicy = "Cannot delete an access config with a security policy set. Please remove the security policy first"

// The tests related to security_policy use network_edge_security_service resource
// which can only exist one per region. Because of that, all the following tests must run serially.
func TestAccComputeInstanceNetworkIntefaceWithSecurityPolicy(t *testing.T) {
// Consistently failing - https://github.com/hashicorp/terraform-provider-google/issues/17838
acctest.SkipIfVcr(t)
testCases := map[string]func(t *testing.T){
"two_access_config": testAccComputeInstance_nic_securityPolicyCreateWithTwoAccessConfigs,
"two_nics_access_config_with_empty_nil_security_policy": testAccComputeInstance_nic_securityPolicyCreateWithEmptyAndNullSecurityPolicies,
Expand Down Expand Up @@ -3548,11 +3548,7 @@ func testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfi
},
{
Config: testAccComputeInstance_nic_securityPolicyCreateWithTwoNicsAndTwoAccessConfigsUpdateTwoPoliciesRemoveAccessConfig(suffix, policyName, policyName2, instanceName, "google_compute_region_security_policy.policyforinstance.self_link", "google_compute_region_security_policy.policyforinstance.self_link"),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
t, "google_compute_instance.foobar", &instance),
testAccCheckComputeInstanceNicAccessConfigHasSecurityPolicy(&instance, policyName),
),
ExpectError: regexp.MustCompile(errorDeleteAccessConfigWithSecPolicy),
},
{
ResourceName: "google_compute_instance.foobar",
Expand Down Expand Up @@ -3658,11 +3654,7 @@ func testAccComputeInstance_nic_securityPolicyCreateWithAccessConfigUpdateAccess
},
{
Config: testAccComputeInstance_nic_securityPolicyCreateWithTwoAccessConfigsUpdateAccessConfig(suffix, policyName, instanceName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeInstanceExists(
t, "google_compute_instance.foobar", &instance),
testAccCheckComputeInstanceNicAccessConfigHasSecurityPolicy(&instance, policyName),
),
ExpectError: regexp.MustCompile(errorDeleteAccessConfigWithSecPolicy),
},
{
ResourceName: "google_compute_instance.foobar",
Expand Down

0 comments on commit bd193c6

Please sign in to comment.