Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change ExpectedError in TestAccComputeInstanceNetworkIntefaceWithSecurityPolicy #11350

Merged
merged 3 commits into from
Sep 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3160,11 +3160,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 @@ -3347,11 +3347,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),
karolgorc marked this conversation as resolved.
Show resolved Hide resolved
},
{
ResourceName: "google_compute_instance.foobar",
Expand Down Expand Up @@ -3457,11 +3453,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