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

Fix VPC20 tests for latest platform changes #1403

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
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
9 changes: 4 additions & 5 deletions nsxt/resource_nsxt_policy_transit_gateway_attachment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,15 @@ resource "nsxt_policy_project" "test" {
tgw_external_connections = [nsxt_policy_gateway_connection.test.path]
}

resource "nsxt_policy_transit_gateway" "test" {
data "nsxt_policy_transit_gateway" "test" {
context {
project_id = nsxt_policy_project.test.id
}
display_name = "%s"
transit_subnets = ["192.168.7.0/24"]
id = "default"
}

resource "nsxt_policy_transit_gateway_attachment" "test" {
parent_path = nsxt_policy_transit_gateway.test.path
parent_path = data.nsxt_policy_transit_gateway.test.path
connection_path = nsxt_policy_gateway_connection.test.path
display_name = "%s"
description = "%s"
Expand All @@ -184,5 +183,5 @@ resource "nsxt_policy_transit_gateway_attachment" "test" {
scope = "scope1"
tag = "tag1"
}
}`, getEdgeClusterName(), dependantEntityName, dependantEntityName, dependantEntityName, dependantEntityName, attrMap["display_name"], attrMap["description"])
}`, getEdgeClusterName(), dependantEntityName, dependantEntityName, dependantEntityName, attrMap["display_name"], attrMap["description"])
}
2 changes: 1 addition & 1 deletion nsxt/resource_nsxt_policy_transit_gateway_nat_rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ resource "nsxt_policy_transit_gateway" "test" {
}

data "nsxt_policy_transit_gateway_nat" "test" {
transit_gateway_path = nsxt_policy_transit_gateway.test.path
transit_gateway_path = data.nsxt_policy_transit_gateway.test.path
}
`, testAccNsxtProjectContext(), accTestTransitGatewayNatRuleHelperName)
}
Expand Down
12 changes: 10 additions & 2 deletions nsxt/resource_nsxt_policy_transit_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ func TestAccResourceNsxtPolicyTransitGateway_basic(t *testing.T) {
testDataSourceName := "nsxt_policy_transit_gateway.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t); testAccOnlyVPC(t) },
PreCheck: func() {
testAccPreCheck(t)
testAccOnlyVPC(t)
testAccNSXVersion(t, "9.1.0")
},
Providers: testAccProviders,
CheckDestroy: func(state *terraform.State) error {
return testAccNsxtPolicyTransitGatewayCheckDestroy(state, accTestTransitGatewayUpdateAttributes["display_name"])
Expand Down Expand Up @@ -88,7 +92,11 @@ func TestAccResourceNsxtPolicyTransitGateway_importBasic(t *testing.T) {
testResourceName := "nsxt_policy_transit_gateway.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t); testAccOnlyVPC(t) },
PreCheck: func() {
testAccPreCheck(t)
testAccOnlyVPC(t)
testAccNSXVersion(t, "9.1.0")
},
Providers: testAccProviders,
CheckDestroy: func(state *terraform.State) error {
return testAccNsxtPolicyTransitGatewayCheckDestroy(state, name)
Expand Down
15 changes: 7 additions & 8 deletions nsxt/resource_nsxt_vpc_connectivity_profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,14 @@ func testAccNsxtVpcConnectivityProfileCheckDestroy(state *terraform.State, displ
return nil
}

var testAccNsxtVpcConnectivityProfileHelper = getAccTestResourceName()

func testAccNsxtVpcConnectivityProfilePrerequisite() string {
//TODO: replace datasource with resource when transit GW creation is enabled
return fmt.Sprintf(`
resource "nsxt_policy_transit_gateway" "test" {
data "nsxt_policy_transit_gateway" "test" {
%s
display_name = "%s"
transit_subnets = ["192.168.7.0/24"]
}`, testAccNsxtProjectContext(), testAccNsxtVpcConnectivityProfileHelper)
id = "default"
}
`, testAccNsxtProjectContext())
}

func testAccNsxtVpcConnectivityProfileTemplate(createFlow bool) string {
Expand All @@ -192,7 +191,7 @@ resource "nsxt_vpc_connectivity_profile" "test" {
%s
display_name = "%s"
description = "%s"
transit_gateway_path = nsxt_policy_transit_gateway.test.path
transit_gateway_path = data.nsxt_policy_transit_gateway.test.path

service_gateway {
nat_config {
Expand Down Expand Up @@ -220,7 +219,7 @@ func testAccNsxtVpcConnectivityProfileMinimalistic() string {
resource "nsxt_vpc_connectivity_profile" "test" {
%s
display_name = "%s"
transit_gateway_path = nsxt_policy_transit_gateway.test.path
transit_gateway_path = data.nsxt_policy_transit_gateway.test.path

}`, testAccNsxtProjectContext(), accTestVpcConnectivityProfileUpdateAttributes["display_name"])
}
2 changes: 1 addition & 1 deletion nsxt/resource_nsxt_vpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ resource "nsxt_vpc_connectivity_profile" "test" {
%s
display_name = "%s"

transit_gateway_path = nsxt_policy_transit_gateway.test.path
transit_gateway_path = data.nsxt_policy_transit_gateway.test.path
service_gateway {
enable = false
}
Expand Down
Loading