-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29ec702
commit 4770a95
Showing
13 changed files
with
1,194 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
nutanix/services/v2/networking/data_source_nutanix_vpc_v2_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package networking_test | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
acc "github.com/terraform-providers/terraform-provider-nutanix/nutanix/acctest" | ||
) | ||
|
||
const datasourceNamevpc = "data.nutanix_vpc_v4.test" | ||
|
||
func TestAccNutanixVpcDataSourceV2_basic(t *testing.T) { | ||
r := acctest.RandInt() | ||
name := fmt.Sprintf("test-vpc-%d", r) | ||
desc := "test vpc description" | ||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { acc.TestAccPreCheck(t) }, | ||
Providers: acc.TestAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccVpcDataSourceConfig(name, desc), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttr(datasourceNamevpc, "name", name), | ||
resource.TestCheckResourceAttr(datasourceNamevpc, "description", desc), | ||
resource.TestCheckResourceAttrSet(datasourceNamevpc, "metadata.#"), | ||
resource.TestCheckResourceAttrSet(datasourceNamevpc, "links.#"), | ||
resource.TestCheckResourceAttrSet(datasourceNamevpc, "snat_ips.#"), | ||
resource.TestCheckResourceAttrSet(datasourceNamevpc, "external_subnets.#"), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccVpcDataSourceConfig(name, desc string) string { | ||
return fmt.Sprintf(` | ||
resource "nutanix_vpc_v4" "test" { | ||
name = "%[1]s" | ||
description = "%[2]s" | ||
external_subnets{ | ||
subnet_reference = "bd319622-1a45-4075-811a-2b0399bf9a49" | ||
} | ||
} | ||
data "nutanix_vpc_v4" "test" { | ||
ext_id = nutanix_vpc_v4.test.ext_id | ||
depends_on = [ | ||
resource.nutanix_vpc_v4.test | ||
] | ||
} | ||
`, name, desc) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.