From d2993190731eb86c867b6ac20b93f7e6b0a9a2e5 Mon Sep 17 00:00:00 2001 From: MrWolong Date: Wed, 27 Nov 2024 18:02:51 +0800 Subject: [PATCH] testcase: Fixed alicloud_das_switch_das_pro test case --- ...source_alicloud_das_switch_das_pro_test.go | 39 +++++++++---------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/alicloud/resource_alicloud_das_switch_das_pro_test.go b/alicloud/resource_alicloud_das_switch_das_pro_test.go index d7a899557c28..afab20b277aa 100644 --- a/alicloud/resource_alicloud_das_switch_das_pro_test.go +++ b/alicloud/resource_alicloud_das_switch_das_pro_test.go @@ -9,11 +9,11 @@ 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") @@ -21,7 +21,7 @@ func TestAccAlicloudDasSwitchDasPro_basic0(t *testing.T) { 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) @@ -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" { @@ -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) }