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

testcase: Fixed alicloud_das_switch_das_pro test case #7911

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
39 changes: 18 additions & 21 deletions alicloud/resource_alicloud_das_switch_das_pro_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
)

func TestAccAlicloudDasSwitchDasPro_basic0(t *testing.T) {
func TestAccAliCloudDasSwitchDasPro_basic0(t *testing.T) {
var v map[string]interface{}
checkoutSupportedRegions(t, true, connectivity.TestSalveRegions)
resourceId := "alicloud_das_switch_das_pro.default"
ra := resourceAttrInit(resourceId, resourceAlicloudDasSwitchDasProMap)
ra := resourceAttrInit(resourceId, AliCloudDasSwitchDasProMap0)
rc := resourceCheckInitWithDescribeMethod(resourceId, &v, func() interface{} {
return &DasService{testAccProvider.Meta().(*connectivity.AliyunClient)}
}, "DescribeDasSwitchDasPro")
rac := resourceAttrCheckInit(rc, ra)
testAccCheck := rac.resourceAttrMapUpdateSet()
rand := acctest.RandIntRange(10000, 99999)
name := fmt.Sprintf("tf-testAccDasSwitchDasPro-name%d", rand)
testAccConfig := resourceTestAccConfigFunc(resourceId, name, resourceAlicloudDasSwitchDasProBasicDependence)
testAccConfig := resourceTestAccConfigFunc(resourceId, name, AliCloudDasSwitchDasProBasicDependence0)
resource.Test(t, resource.TestCase{
PreCheck: func() {
testAccPreCheck(t)
Expand Down Expand Up @@ -53,14 +53,14 @@ func TestAccAlicloudDasSwitchDasPro_basic0(t *testing.T) {
})
}

var resourceAlicloudDasSwitchDasProMap = map[string]string{
var AliCloudDasSwitchDasProMap0 = map[string]string{
"status": CHECKSET,
}

func resourceAlicloudDasSwitchDasProBasicDependence(name string) string {
func AliCloudDasSwitchDasProBasicDependence0(name string) string {
return fmt.Sprintf(`
variable "name" {
default = "%s"
default = "%s"
}

data "alicloud_account" "default" {
Expand All @@ -70,28 +70,25 @@ func resourceAlicloudDasSwitchDasProBasicDependence(name string) string {
name_regex = "^default-NODELETING$"
}

data "alicloud_polardb_zones" "default"{}

data "alicloud_vswitches" "default" {
zone_id = data.alicloud_polardb_zones.default.ids[length(data.alicloud_polardb_zones.default.ids)-1]
vpc_id = data.alicloud_vpcs.default.ids.0
zone_id = data.alicloud_polardb_node_classes.default.classes.0.zone_id
vpc_id = data.alicloud_vpcs.default.ids.0
}

data "alicloud_polardb_node_classes" "default" {
db_type = "MySQL"
db_version = "8.0"
pay_type = "PostPaid"
zone_id = data.alicloud_polardb_zones.default.ids[length(data.alicloud_polardb_zones.default.ids)-1]
category = "Normal"
db_type = "MySQL"
db_version = "8.0"
pay_type = "PostPaid"
category = "Normal"
}

resource "alicloud_polardb_cluster" "default" {
db_type = "MySQL"
db_version = "8.0"
pay_type = "PostPaid"
db_node_class = data.alicloud_polardb_node_classes.default.classes.0.supported_engines.0.available_resources.0.db_node_class
vswitch_id = data.alicloud_vswitches.default.ids.0
description = "${var.name}"
db_type = "MySQL"
db_version = "8.0"
pay_type = "PostPaid"
db_node_class = data.alicloud_polardb_node_classes.default.classes.0.supported_engines.0.available_resources.0.db_node_class
vswitch_id = data.alicloud_vswitches.default.ids.0
description = var.name
}
`, name)
}
Loading