forked from ovh/terraform-provider-ovh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata_cloud_project_volume_test.go
39 lines (35 loc) · 1.1 KB
/
data_cloud_project_volume_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package ovh
import (
"fmt"
"os"
"testing"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
)
func TestAccDataSourceCloudProjectVolume_basic(t *testing.T) {
serviceName := os.Getenv("OVH_CLOUD_PROJECT_SERVICE_TEST")
regionName := os.Getenv("OVH_CLOUD_PROJECT_REGION_TEST")
volumeId := os.Getenv("OVH_CLOUD_PROJECT_VOLUME_ID_TEST")
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheckCloud(t); testAccCheckCloudProjectExists(t) },
Steps: []resource.TestStep{
{
Config: fmt.Sprintf(`
data "ovh_cloud_project_volume" "volume" {
service_name = "%s"
region_name = "%s"
volume_id = "%s"
}
`,
serviceName,
regionName,
volumeId,
),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("data.ovh_cloud_project_volume.volume", "region_name", os.Getenv("OVH_CLOUD_PROJECT_REGION_TEST")),
resource.TestCheckResourceAttrSet("data.ovh_cloud_project_volume.volume", "name"),
resource.TestCheckResourceAttrSet("data.ovh_cloud_project_volume.volume", "volume_id"),
),
},
},
})
}