From f66369117da1409f281e1f91df79bfea5a23d60f Mon Sep 17 00:00:00 2001 From: YanniHu1996 Date: Tue, 11 Jul 2023 14:08:33 +0800 Subject: [PATCH] fix: Removed data_source_regions --- .env.example | 9 ++++----- pkg/provider/data_source_region_test.go | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.env.example b/.env.example index b8db397f..97597b9a 100644 --- a/.env.example +++ b/.env.example @@ -18,8 +18,7 @@ BA_TF_ACC_VAR_region_region_id= BA_TF_ACC_VAR_pgd_project_id= BA_TF_ACC_VAR_pgd_name= -# data_source_regions -BA_TF_ACC_VAR_regions_project_id= -BA_TF_ACC_VAR_regions_provider= -BA_TF_ACC_VAR_regions_region_id= -BA_TF_ACC_VAR_regions_status= +# data_source_region +BA_TF_ACC_VAR_ds_region_project_id= +BA_TF_ACC_VAR_ds_region_provider= +BA_TF_ACC_VAR_ds_region_region_id= diff --git a/pkg/provider/data_source_region_test.go b/pkg/provider/data_source_region_test.go index a7b36fce..e41c97ca 100644 --- a/pkg/provider/data_source_region_test.go +++ b/pkg/provider/data_source_region_test.go @@ -11,34 +11,34 @@ import ( func TestAccDataSourceRegion_basic(t *testing.T) { var ( acc_env_vars_checklist = []string{ - "BA_TF_ACC_VAR_region_project_id", - "BA_TF_ACC_VAR_region_provider", - "BA_TF_ACC_VAR_region_region_id", + "BA_TF_ACC_VAR_ds_region_project_id", + "BA_TF_ACC_VAR_ds_region_provider", + "BA_TF_ACC_VAR_ds_region_region_id", } - projectId = os.Getenv("BA_TF_ACC_VAR_region_project_id") - provider = os.Getenv("BA_TF_ACC_VAR_region_provider") - regionId = os.Getenv("BA_TF_ACC_VAR_region_region_id") + projectId = os.Getenv("BA_TF_ACC_VAR_ds_region_project_id") + provider = os.Getenv("BA_TF_ACC_VAR_ds_region_provider") + regionId = os.Getenv("BA_TF_ACC_VAR_ds_region_region_id") ) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) - testAccResourcePreCheck(t, "datasource region", acc_env_vars_checklist) + testAccResourcePreCheck(t, "datasource regions", acc_env_vars_checklist) }, ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ { - Config: regionDataSourceConfig(projectId, provider, regionId), + Config: regionsDataSourceConfig(projectId, provider, regionId), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrPair("data.biganimal_region.test", "region.0.name", "biganimal_region.test", "name"), - resource.TestCheckResourceAttrPair("data.biganimal_region.test", "region.0.status", "biganimal_region.test", "status"), + resource.TestCheckResourceAttrPair("data.biganimal_region.test", "regions.0.name", "biganimal_region.test", "name"), + resource.TestCheckResourceAttrPair("data.biganimal_region.test", "regions.0.status", "biganimal_region.test", "status"), ), }, }, }) } -func regionDataSourceConfig(projectId, provider, regionId string) string { +func regionsDataSourceConfig(projectId, provider, regionId string) string { return fmt.Sprintf(`data "biganimal_region" "test" { project_id = "%[1]s" cloud_provider = "%[2]s"