-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: create edge_gateway_resource + tests
- Loading branch information
Showing
5 changed files
with
225 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package provider | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
) | ||
|
||
const testAccEdgeGatewayResourceConfig = ` | ||
resource "cloudavenue_edge_gateway" "test" { | ||
owner_type = "vdc" | ||
owner_name = "myVDC01" | ||
tier0_vrf_name = "prvrf01iocb0000001allsp01" | ||
} | ||
` | ||
|
||
// const testAccEdgeGatewayResourceWithBadOwnerTypeConfig = ` | ||
// resource "cloudavenue_edge_gateway" "test" { | ||
// owner_type = "vdc-bad" | ||
// owner_name = "myVDC01" | ||
// tier0_vrf_name = "prvrf01iocb0000001allsp01" | ||
// } | ||
// ` | ||
|
||
func TestAccEdgeGatewayResource(t *testing.T) { | ||
resourceName := "cloudavenue_edge_gateway.test" | ||
|
||
// resourceNameVDCGroup := "cloudavenue_edge_gateway.test-group" | ||
configEdgeGateway = func() edgeGatewayConfig { | ||
return edgeGatewayConfig{ | ||
checkJobDelay: 10 * time.Millisecond, | ||
} | ||
} | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, | ||
Steps: []resource.TestStep{ | ||
// Read testing | ||
{ | ||
Config: testAccEdgeGatewayResourceConfig, | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
resource.TestCheckResourceAttr(resourceName, "id", "cc1f35c2-90a2-48d1-9359-62794faf44ad"), | ||
resource.TestCheckResourceAttr(resourceName, "edge_id", "cc1f35c2-90a2-48d1-9359-62794faf44ad"), | ||
resource.TestCheckResourceAttr(resourceName, "owner_type", "vdc"), | ||
resource.TestCheckResourceAttr(resourceName, "owner_name", "myVDC01"), | ||
resource.TestCheckResourceAttr(resourceName, "tier0_vrf_name", "prvrf01iocb0000001allsp01"), | ||
resource.TestCheckResourceAttr(resourceName, "edge_name", "edgeName"), | ||
resource.TestCheckResourceAttr(resourceName, "description", "description"), | ||
), | ||
}, | ||
// ImportState testing | ||
// { | ||
// ResourceName: resourceName, | ||
// ImportState: true, | ||
// ImportStateId: "cc1f35c2-90a2-48d1-9359-62794faf44ad", | ||
// ImportStateVerify: true, | ||
// }, | ||
// check bad owner_type | ||
// https://github.com/hashicorp/terraform-plugin-sdk/issues/609 | ||
// { | ||
// Config: testAccEdgeGatewayResourceWithBadOwnerTypeConfig, | ||
// ExpectError: regexp.MustCompile(`.*`), | ||
// Destroy: true, | ||
// }, | ||
// { | ||
// Config: testAccEdgeGatewayGroupResourceConfig, | ||
// Check: resource.ComposeAggregateTestCheckFunc( | ||
// resource.TestCheckResourceAttr(resourceNameVDCGroup, "id", "cc1f35c2-90a2-48d1-9359-62794faf44ae"), | ||
// resource.TestCheckResourceAttr(resourceNameVDCGroup, "edge_id", "cc1f35c2-90a2-48d1-9359-62794faf44ae"), | ||
// resource.TestCheckResourceAttr(resourceNameVDCGroup, "owner_type", "vdc-group"), | ||
// resource.TestCheckResourceAttr(resourceNameVDCGroup, "owner_name", "myVDC02"), | ||
// resource.TestCheckResourceAttr(resourceNameVDCGroup, "tier0_vrf_id", "prvrf01iocb0000001allsp01"), | ||
// resource.TestCheckResourceAttr(resourceNameVDCGroup, "edge_name", "edgeName2"), | ||
// resource.TestCheckResourceAttr(resourceNameVDCGroup, "description", "description"), | ||
// ), | ||
// }, | ||
}, | ||
}) | ||
} |
Oops, something went wrong.