forked from PagerDuty/terraform-provider-pagerduty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimport_pagerduty_schedule_test.go
36 lines (31 loc) · 1.06 KB
/
import_pagerduty_schedule_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
package pagerduty
import (
"fmt"
"testing"
"time"
"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
)
func TestAccPagerDutySchedule_import(t *testing.T) {
username := fmt.Sprintf("tf-%s", acctest.RandString(5))
email := fmt.Sprintf("%s@foo.com", username)
schedule := fmt.Sprintf("tf-%s", acctest.RandString(5))
location := "Europe/Berlin"
start := timeNowInLoc(location).Add(24 * time.Hour).Round(1 * time.Hour).Format(time.RFC3339)
rotationVirtualStart := timeNowInLoc(location).Add(24 * time.Hour).Round(1 * time.Hour).Format(time.RFC3339)
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckPagerDutyUserDestroy,
Steps: []resource.TestStep{
{
Config: testAccCheckPagerDutyScheduleConfig(username, email, schedule, location, start, rotationVirtualStart),
},
{
ResourceName: "pagerduty_schedule.foo",
ImportState: true,
ImportStateVerify: true,
},
},
})
}