terraform/builtin/providers/pagerduty/import_pagerduty_service_te...

58 lines
1.6 KiB
Go
Raw Normal View History

2016-09-23 21:43:06 +02:00
package pagerduty
import (
"fmt"
2016-09-23 21:43:06 +02:00
"testing"
"github.com/hashicorp/terraform/helper/acctest"
2016-09-23 21:43:06 +02:00
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccPagerDutyService_import(t *testing.T) {
username := fmt.Sprintf("tf-%s", acctest.RandString(5))
email := fmt.Sprintf("%s@foo.com", username)
escalationPolicy := fmt.Sprintf("tf-%s", acctest.RandString(5))
service := fmt.Sprintf("tf-%s", acctest.RandString(5))
2016-10-16 16:48:20 +02:00
2016-09-23 21:43:06 +02:00
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckPagerDutyServiceDestroy,
Steps: []resource.TestStep{
{
Config: testAccCheckPagerDutyServiceConfig(username, email, escalationPolicy, service),
2016-09-23 21:43:06 +02:00
},
2016-10-16 16:48:20 +02:00
{
ResourceName: "pagerduty_service.foo",
2016-09-23 21:43:06 +02:00
ImportState: true,
2016-10-16 16:48:20 +02:00
ImportStateVerify: true,
2016-09-23 21:43:06 +02:00
},
},
})
}
func TestAccPagerDutyServiceWithIncidentUrgency_import(t *testing.T) {
username := fmt.Sprintf("tf-%s", acctest.RandString(5))
email := fmt.Sprintf("%s@foo.com", username)
escalationPolicy := fmt.Sprintf("tf-%s", acctest.RandString(5))
service := fmt.Sprintf("tf-%s", acctest.RandString(5))
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckPagerDutyServiceDestroy,
Steps: []resource.TestStep{
{
Config: testAccCheckPagerDutyServiceWithIncidentUrgencyRulesConfig(username, email, escalationPolicy, service),
},
{
ResourceName: "pagerduty_service.foo",
ImportState: true,
ImportStateVerify: true,
},
},
})
}