-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(EIP): Synchronized EIP dataSources, unit test and document.
- Loading branch information
1 parent
ba09928
commit ce8986e
Showing
3 changed files
with
64 additions
and
5 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
54 changes: 54 additions & 0 deletions
54
flexibleengine/acceptance/data_source_flexibleengine_vpc_eip_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,54 @@ | ||
package acceptance | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
"github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud/services/acceptance" | ||
) | ||
|
||
func TestAccVpcEipDataSource_basic(t *testing.T) { | ||
randName := acceptance.RandomAccResourceName() | ||
dataSourceName := "data.flexibleengine_vpc_eip.test" | ||
|
||
dc := acceptance.InitDataSourceCheck(dataSourceName) | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
ProviderFactories: TestAccProviderFactories, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccDataSourceVpcEipConfig_basic(randName), | ||
Check: resource.ComposeTestCheckFunc( | ||
dc.CheckResourceExists(), | ||
resource.TestCheckResourceAttr(dataSourceName, "status", "UNBOUND"), | ||
resource.TestCheckResourceAttr(dataSourceName, "type", "5_bgp"), | ||
resource.TestCheckResourceAttr(dataSourceName, "ip_version", "4"), | ||
resource.TestCheckResourceAttr(dataSourceName, "bandwidth_size", "5"), | ||
resource.TestCheckResourceAttr(dataSourceName, "bandwidth_share_type", "PER"), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccDataSourceVpcEipConfig_basic(rName string) string { | ||
return fmt.Sprintf(` | ||
resource "flexibleengine_vpc_eip" "test" { | ||
publicip { | ||
type = "5_bgp" | ||
} | ||
bandwidth { | ||
name = "%s" | ||
size = 5 | ||
share_type = "PER" | ||
charge_mode = "traffic" | ||
} | ||
} | ||
data "flexibleengine_vpc_eip" "test" { | ||
public_ip = flexibleengine_vpc_eip.test.address | ||
} | ||
`, rName) | ||
} |
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