forked from PagerDuty/terraform-provider-pagerduty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimport_pagerduty_ruleset_test.go
52 lines (44 loc) · 1.24 KB
/
import_pagerduty_ruleset_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
40
41
42
43
44
45
46
47
48
49
50
51
52
package pagerduty
import (
"fmt"
"testing"
"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
)
func TestAccPagerDutyRuleset_import(t *testing.T) {
ruleset := fmt.Sprintf("tf-%s", acctest.RandString(5))
teamName := fmt.Sprintf("tf-%s", acctest.RandString(5))
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckPagerDutyRulesetDestroy,
Steps: []resource.TestStep{
{
Config: testAccCheckPagerDutyRulesetConfig(ruleset, teamName),
},
{
ResourceName: "pagerduty_ruleset.foo",
ImportState: true,
ImportStateVerify: true,
},
},
})
}
func TestAccPagerDutyRulesetWithNoTeam_import(t *testing.T) {
ruleset := fmt.Sprintf("tf-%s", acctest.RandString(5))
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckPagerDutyRulesetDestroy,
Steps: []resource.TestStep{
{
Config: testAccCheckPagerDutyRulesetConfigNoTeam(ruleset),
},
{
ResourceName: "pagerduty_ruleset.noteam",
ImportState: true,
ImportStateVerify: true,
},
},
})
}