-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathdata_source_sysdig_monitor_team_ibm_test.go
More file actions
53 lines (45 loc) · 1.47 KB
/
data_source_sysdig_monitor_team_ibm_test.go
File metadata and controls
53 lines (45 loc) · 1.47 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//go:build tf_acc_ibm_monitor
package sysdig_test
import (
"fmt"
"testing"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/draios/terraform-provider-sysdig/sysdig"
)
func TestAccDataSourceSysdigMonitorTeamIBM(t *testing.T) {
name := fmt.Sprintf("test-monitor-team-%s", randomText(5))
resource.Test(t, resource.TestCase{
PreCheck: preCheckAnyEnv(t, SysdigIBMMonitorAPIKeyEnv),
ProviderFactories: map[string]func() (*schema.Provider, error){
"sysdig": func() (*schema.Provider, error) {
return sysdig.Provider(), nil
},
},
Steps: []resource.TestStep{
{
Config: monitorTeamWithPlatformMetricsAndDatasourceIBM(name),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.sysdig_monitor_team.test", "name", name),
resource.TestCheckResourceAttr("data.sysdig_monitor_team.test", "enable_ibm_platform_metrics", "true"),
resource.TestCheckResourceAttr("data.sysdig_monitor_team.test", "ibm_platform_metrics", "foo in (\"0\") and bar in (\"3\")"),
),
},
},
})
}
func monitorTeamWithPlatformMetricsAndDatasourceIBM(name string) string {
return fmt.Sprintf(`
resource "sysdig_monitor_team" "sample" {
name = "%s"
enable_ibm_platform_metrics = true
ibm_platform_metrics = "foo in (\"0\") and bar in (\"3\")"
entrypoint {
type = "Dashboards"
}
}
data "sysdig_monitor_team" "test" {
id = sysdig_monitor_team.sample.id
}
`, name)
}