Skip to content

Commit

Permalink
fix: Removed data_source_regions
Browse files Browse the repository at this point in the history
  • Loading branch information
YanniHu1996 committed Jul 11, 2023
1 parent 2f9857d commit f663691
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
9 changes: 4 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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=
22 changes: 11 additions & 11 deletions pkg/provider/data_source_region_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit f663691

Please sign in to comment.