-
Notifications
You must be signed in to change notification settings - Fork 251
/
Copy pathdata_source_cloud_organization_test.go
37 lines (32 loc) · 1.18 KB
/
data_source_cloud_organization_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
package cloud_test
import (
"fmt"
"os"
"testing"
"github.com/grafana/terraform-provider-grafana/v3/internal/common"
"github.com/grafana/terraform-provider-grafana/v3/internal/testutils"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)
func TestAccDataSourceOrganization_Basic(t *testing.T) {
testutils.CheckCloudAPITestsEnabled(t)
config := fmt.Sprintf(`
data "grafana_cloud_organization" "test" {
slug = "%s"
}
`, os.Getenv("GRAFANA_CLOUD_ORG"))
resource.ParallelTest(t, resource.TestCase{
ProtoV5ProviderFactories: testutils.ProtoV5ProviderFactories,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
resource.TestMatchResourceAttr("data.grafana_cloud_organization.test", "id", common.IDRegexp),
resource.TestCheckResourceAttr("data.grafana_cloud_organization.test", "slug", os.Getenv("GRAFANA_CLOUD_ORG")),
resource.TestCheckResourceAttrSet("data.grafana_cloud_organization.test", "name"),
resource.TestCheckResourceAttrSet("data.grafana_cloud_organization.test", "created_at"),
resource.TestCheckResourceAttrSet("data.grafana_cloud_organization.test", "updated_at"),
),
},
},
})
}