diff --git a/GNUmakefile b/GNUmakefile index 5ed7053c..3a9a98d9 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -50,6 +50,10 @@ test: testacc: TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m +sweeper: + @echo "WARNING: This will destroy infrastructure. Use only in development accounts." + go test ./internal/provider -v -tags=sweep -sweep=all -sweep-allow-failures -timeout 120m + codegen: curl $(SWAGGER_URL) -o schema/swagger.json node tools/clean-swagger.js schema/swagger.json @@ -127,6 +131,7 @@ help: @echo " make docs - Generate documentation" @echo " make test - Run unit tests" @echo " make testacc - Run acceptance tests" + @echo " make sweeper - Delete resources created by acceptance tests. They have names starting with tf-" @echo " make install - Install provider locally" @echo " make release - Create local snapshot build" @echo "" diff --git a/go.mod b/go.mod index 70e6b02d..386ee13e 100644 --- a/go.mod +++ b/go.mod @@ -54,13 +54,14 @@ require ( github.com/hashicorp/logutils v1.0.0 // indirect github.com/hashicorp/terraform-exec v0.23.1 // indirect github.com/hashicorp/terraform-json v0.27.0 // indirect - github.com/hashicorp/terraform-plugin-framework v1.16.1 // indirect + github.com/hashicorp/terraform-plugin-framework v1.16.1 github.com/hashicorp/terraform-plugin-testing v1.13.3 github.com/hashicorp/terraform-registry-address v0.4.0 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect github.com/hashicorp/yamux v0.1.2 // indirect github.com/huandu/xstrings v1.5.0 // indirect github.com/invopop/yaml v0.3.1 // indirect + github.com/jianyuan/go-utils v0.0.0-20250223213401-62c93a9e0b6c github.com/josharian/intern v1.0.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.14 // indirect diff --git a/go.sum b/go.sum index 5221aefa..30f02bee 100644 --- a/go.sum +++ b/go.sum @@ -167,6 +167,8 @@ github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOl github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jhump/protoreflect v1.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5XumQh94= github.com/jhump/protoreflect v1.17.0/go.mod h1:h9+vUUL38jiBzck8ck+6G/aeMX8Z4QUY/NiJPwPNi+8= +github.com/jianyuan/go-utils v0.0.0-20250223213401-62c93a9e0b6c h1:VG+sd6t1wnle1Rc9Z52CmsYuwhBkXcW+aPIHqcw9e0I= +github.com/jianyuan/go-utils v0.0.0-20250223213401-62c93a9e0b6c/go.mod h1:D1O+WiG+p0g3LExvWtPEn6+UDTKJoUxTfJxyM6Ya6+k= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE= diff --git a/internal/acctest/shared_client.go b/internal/acctest/shared_client.go new file mode 100644 index 00000000..a49425c6 --- /dev/null +++ b/internal/acctest/shared_client.go @@ -0,0 +1,36 @@ +package acctest + +import ( + "log" + "os" + + "github.com/rootlyhq/terraform-provider-rootly/v2/internal/apiclient" + "github.com/rootlyhq/terraform-provider-rootly/v2/meta" + rootly "github.com/rootlyhq/terraform-provider-rootly/v2/schema" +) + +var ( + TestApiHost string + TestApiToken string + + SharedClient *rootly.ClientWithResponses +) + +func init() { + if v := os.Getenv("ROOTLY_API_URL"); v != "" { + TestApiHost = v + } else { + TestApiHost = "https://api.rootly.com" + } + + if v := os.Getenv("ROOTLY_API_TOKEN"); v != "" { + TestApiToken = v + } + + _, client, err := apiclient.New(TestApiHost, TestApiToken, meta.GetVersion()) + if err != nil { + log.Fatalln(err.Error()) + } + + SharedClient = client +} diff --git a/internal/apiclient/apiclient.go b/internal/apiclient/apiclient.go new file mode 100644 index 00000000..e7dfc7c2 --- /dev/null +++ b/internal/apiclient/apiclient.go @@ -0,0 +1,27 @@ +package apiclient + +import ( + "fmt" + + "github.com/rootlyhq/terraform-provider-rootly/v2/client" + sdkv2_provider "github.com/rootlyhq/terraform-provider-rootly/v2/provider" + rootly "github.com/rootlyhq/terraform-provider-rootly/v2/schema" +) + +func New(apiHost string, apiToken string, version string) (*client.Client, *rootly.ClientWithResponses, error) { + legacyClient, err := client.NewClient(apiHost, apiToken, sdkv2_provider.RootlyUserAgent(version)) + if err != nil { + return nil, nil, fmt.Errorf("unable to create Rootly client: %v", err) + } + + client, err := rootly.NewClientWithResponses( + apiHost, + // Piggyback on the legacy client's HTTP client. Inherits the same headers, authentication, and retry logic. + rootly.WithHTTPClient(legacyClient), + ) + if err != nil { + return nil, nil, fmt.Errorf("unable to create Rootly client: %v", err) + } + + return legacyClient, client, nil +} diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 37139a9a..150a5999 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/rootlyhq/terraform-provider-rootly/v2/client" - sdkv2_provider "github.com/rootlyhq/terraform-provider-rootly/v2/provider" + "github.com/rootlyhq/terraform-provider-rootly/v2/internal/apiclient" rootly "github.com/rootlyhq/terraform-provider-rootly/v2/schema" ) @@ -75,19 +75,9 @@ func (p *RootlyProvider) Configure(ctx context.Context, req provider.ConfigureRe apiToken = v } - legacyClient, err := client.NewClient(apiHost, apiToken, sdkv2_provider.RootlyUserAgent(p.version)) + legacyClient, client, err := apiclient.New(apiHost, apiToken, p.version) if err != nil { - resp.Diagnostics.AddError("Unable to create Rootly client", "Unable to authenticate user for authenticated Rootly client") - return - } - - client, err := rootly.NewClientWithResponses( - apiHost, - // Piggyback on the legacy client's HTTP client. Inherits the same headers, authentication, and retry logic. - rootly.WithHTTPClient(legacyClient), - ) - if err != nil { - resp.Diagnostics.AddError("Unable to create Rootly client", "Unable to authenticate user for authenticated Rootly client") + resp.Diagnostics.AddError("Unable to create Rootly client", err.Error()) return } diff --git a/internal/provider/provider_test.go b/internal/provider/provider_test.go index 99230b00..a693b156 100644 --- a/internal/provider/provider_test.go +++ b/internal/provider/provider_test.go @@ -8,10 +8,15 @@ import ( "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/hashicorp/terraform-plugin-mux/tf5to6server" "github.com/hashicorp/terraform-plugin-mux/tf6muxserver" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/rootlyhq/terraform-provider-rootly/v2/meta" sdkv2_provider "github.com/rootlyhq/terraform-provider-rootly/v2/provider" ) +func TestMain(m *testing.M) { + resource.TestMain(m) +} + var testAccProtoV6ProviderFactories = map[string]func() (tfprotov6.ProviderServer, error){ "rootly": func() (tfprotov6.ProviderServer, error) { ctx := context.Background() diff --git a/internal/provider/resource_alert_route_test.go b/internal/provider/resource_alert_route_test.go new file mode 100644 index 00000000..f8a364e7 --- /dev/null +++ b/internal/provider/resource_alert_route_test.go @@ -0,0 +1,59 @@ +package provider + +import ( + "context" + "fmt" + "log" + "net/http" + "strings" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/jianyuan/go-utils/ptr" + "github.com/rootlyhq/terraform-provider-rootly/v2/internal/acctest" + rootly "github.com/rootlyhq/terraform-provider-rootly/v2/schema" +) + +func init() { + resource.AddTestSweepers("rootly_alert_route", &resource.Sweeper{ + Name: "rootly_alert_route", + F: func(region string) error { + ctx := context.Background() + + params := &rootly.ListAlertRoutesParams{ + PageNumber: ptr.Ptr(1), + } + + for { + httpResp, err := acctest.SharedClient.ListAlertRoutesWithResponse(ctx, params) + if err != nil { + return fmt.Errorf("Error getting alert routes, got error: %s", err) + } else if httpResp.StatusCode() != http.StatusOK { + return fmt.Errorf("Error getting alert routes, got status code: %d", httpResp.StatusCode()) + } else if httpResp.ApplicationvndApiJSON200 == nil { + return fmt.Errorf("Error getting alert routes, got empty response") + } + + for _, alertRoute := range httpResp.ApplicationvndApiJSON200.Data { + if strings.HasPrefix(alertRoute.Attributes.Name, "tf-") { + httpResp, err := acctest.SharedClient.DeleteAlertRouteWithResponse(ctx, alertRoute.Id) + if err != nil { + return fmt.Errorf("Error deleting alert route: %s", err) + } else if httpResp.StatusCode() != http.StatusOK { + return fmt.Errorf("Error deleting alert route, got status code: %d", httpResp.StatusCode()) + } + + log.Printf("[INFO] Deleted alert route %s", alertRoute.Attributes.Name) + } + } + + if httpResp.ApplicationvndApiJSON200.Links.Next == nil { + break + } + + params.PageNumber = ptr.Ptr(ptr.Value(params.PageNumber) + 1) + } + + return nil + }, + }) +} diff --git a/internal/provider/resource_alert_urgency_test.go b/internal/provider/resource_alert_urgency_test.go new file mode 100644 index 00000000..c17341fd --- /dev/null +++ b/internal/provider/resource_alert_urgency_test.go @@ -0,0 +1,105 @@ +package provider + +import ( + "context" + "fmt" + "log" + "net/http" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/knownvalue" + "github.com/hashicorp/terraform-plugin-testing/statecheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" + "github.com/jianyuan/go-utils/ptr" + "github.com/rootlyhq/terraform-provider-rootly/v2/internal/acctest" + rootly "github.com/rootlyhq/terraform-provider-rootly/v2/schema" +) + +func init() { + resource.AddTestSweepers("rootly_alert_urgency", &resource.Sweeper{ + Name: "rootly_alert_urgency", + F: func(region string) error { + ctx := context.Background() + + params := &rootly.ListAlertUrgenciesParams{ + PageNumber: ptr.Ptr(1), + } + + for { + httpResp, err := acctest.SharedClient.ListAlertUrgenciesWithResponse(ctx, params) + if err != nil { + return fmt.Errorf("Error getting alert urgencies, got error: %s", err) + } else if httpResp.StatusCode() != http.StatusOK { + return fmt.Errorf("Error getting alert urgencies, got status code: %d", httpResp.StatusCode()) + } else if httpResp.ApplicationvndApiJSON200 == nil { + return fmt.Errorf("Error getting alert urgencies, got empty response") + } + + for _, alertUrgency := range httpResp.ApplicationvndApiJSON200.Data { + if strings.HasPrefix(alertUrgency.Attributes.Name, "tf-") { + httpResp, err := acctest.SharedClient.DeleteAlertUrgencyWithResponse(ctx, alertUrgency.Id) + if err != nil { + return fmt.Errorf("Error deleting alert urgency: %s", err) + } else if httpResp.StatusCode() != http.StatusOK { + return fmt.Errorf("Error deleting alert urgency, got status code: %d", httpResp.StatusCode()) + } + + log.Printf("[INFO] Deleted alert urgency %s", alertUrgency.Attributes.Name) + } + } + + if httpResp.ApplicationvndApiJSON200.Links.Next == nil { + break + } + + params.PageNumber = ptr.Ptr(ptr.Value(params.PageNumber) + 1) + } + + return nil + }, + }) +} + +func TestAccResourceAlertUrgency(t *testing.T) { + resName := "rootly_alert_urgency.test" + alertUrgencyName := acctest.RandomWithPrefix("tf-alert-urgency") + + configStateChecks := []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resName, tfjsonpath.New("id"), knownvalue.NotNull()), + statecheck.ExpectKnownValue(resName, tfjsonpath.New("position"), knownvalue.NotNull()), + } + + resource.UnitTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testAccResourceAlertUrgency(alertUrgencyName, "description"), + ConfigStateChecks: append( + configStateChecks, + statecheck.ExpectKnownValue(resName, tfjsonpath.New("name"), knownvalue.StringExact(alertUrgencyName)), + statecheck.ExpectKnownValue(resName, tfjsonpath.New("description"), knownvalue.StringExact("description")), + ), + }, + { + Config: testAccResourceAlertUrgency(alertUrgencyName+"-updated", "updated description"), + ConfigStateChecks: append( + configStateChecks, + statecheck.ExpectKnownValue(resName, tfjsonpath.New("name"), knownvalue.StringExact(alertUrgencyName+"-updated")), + statecheck.ExpectKnownValue(resName, tfjsonpath.New("description"), knownvalue.StringExact("updated description")), + ), + }, + }, + }) +} + +func testAccResourceAlertUrgency(alertUrgencyName, alertUrgencyDescription string) string { + return fmt.Sprintf(` +resource "rootly_alert_urgency" "test" { + name = "%s" + description = "%s" +} +`, alertUrgencyName, alertUrgencyDescription) +} diff --git a/internal/provider/resource_alerts_source_test.go b/internal/provider/resource_alerts_source_test.go new file mode 100644 index 00000000..7b7eb90d --- /dev/null +++ b/internal/provider/resource_alerts_source_test.go @@ -0,0 +1,59 @@ +package provider + +import ( + "context" + "fmt" + "log" + "net/http" + "strings" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/jianyuan/go-utils/ptr" + "github.com/rootlyhq/terraform-provider-rootly/v2/internal/acctest" + rootly "github.com/rootlyhq/terraform-provider-rootly/v2/schema" +) + +func init() { + resource.AddTestSweepers("rootly_alerts_source", &resource.Sweeper{ + Name: "rootly_alerts_source", + F: func(region string) error { + ctx := context.Background() + + params := &rootly.ListAlertsSourcesParams{ + PageNumber: ptr.Ptr(1), + } + + for { + httpResp, err := acctest.SharedClient.ListAlertsSourcesWithResponse(ctx, params) + if err != nil { + return fmt.Errorf("Error getting alerts sources, got error: %s", err) + } else if httpResp.StatusCode() != http.StatusOK { + return fmt.Errorf("Error getting alerts sources, got status code: %d", httpResp.StatusCode()) + } else if httpResp.ApplicationvndApiJSON200 == nil { + return fmt.Errorf("Error getting alerts sources, got empty response") + } + + for _, alertSource := range httpResp.ApplicationvndApiJSON200.Data { + if strings.HasPrefix(alertSource.Attributes.Name, "tf-") { + httpResp, err := acctest.SharedClient.DeleteAlertsSourceWithResponse(ctx, alertSource.Id) + if err != nil { + return fmt.Errorf("Error deleting alerts source: %s", err) + } else if httpResp.StatusCode() != http.StatusOK { + return fmt.Errorf("Error deleting alerts source, got status code: %d", httpResp.StatusCode()) + } + + log.Printf("[INFO] Deleted alerts source %s", alertSource.Attributes.Name) + } + } + + if httpResp.ApplicationvndApiJSON200.Links.Next == nil { + break + } + + params.PageNumber = ptr.Ptr(ptr.Value(params.PageNumber) + 1) + } + + return nil + }, + }) +} diff --git a/internal/provider/resource_escalation_policy_test.go b/internal/provider/resource_escalation_policy_test.go new file mode 100644 index 00000000..0b0ae9fd --- /dev/null +++ b/internal/provider/resource_escalation_policy_test.go @@ -0,0 +1,59 @@ +package provider + +import ( + "context" + "fmt" + "log" + "net/http" + "strings" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/jianyuan/go-utils/ptr" + "github.com/rootlyhq/terraform-provider-rootly/v2/internal/acctest" + rootly "github.com/rootlyhq/terraform-provider-rootly/v2/schema" +) + +func init() { + resource.AddTestSweepers("rootly_escalation_policy", &resource.Sweeper{ + Name: "rootly_escalation_policy", + F: func(region string) error { + ctx := context.Background() + + params := &rootly.ListEscalationPoliciesParams{ + PageNumber: ptr.Ptr(1), + } + + for { + httpResp, err := acctest.SharedClient.ListEscalationPoliciesWithResponse(ctx, params) + if err != nil { + return fmt.Errorf("Error getting escalation policies, got error: %s", err) + } else if httpResp.StatusCode() != http.StatusOK { + return fmt.Errorf("Error getting escalation policies, got status code: %d", httpResp.StatusCode()) + } else if httpResp.ApplicationvndApiJSON200 == nil { + return fmt.Errorf("Error getting escalation policies, got empty response") + } + + for _, escalationPolicy := range httpResp.ApplicationvndApiJSON200.Data { + if strings.HasPrefix(escalationPolicy.Attributes.Name, "tf-") { + httpResp, err := acctest.SharedClient.DeleteEscalationPolicyWithResponse(ctx, escalationPolicy.Id) + if err != nil { + return fmt.Errorf("Error deleting escalation policy: %s", err) + } else if httpResp.StatusCode() != http.StatusOK { + return fmt.Errorf("Error deleting escalation policy, got status code: %d", httpResp.StatusCode()) + } + + log.Printf("[INFO] Deleted escalation policy %s", escalationPolicy.Attributes.Name) + } + } + + if httpResp.ApplicationvndApiJSON200.Links.Next == nil { + break + } + + params.PageNumber = ptr.Ptr(ptr.Value(params.PageNumber) + 1) + } + + return nil + }, + }) +} diff --git a/internal/provider/resource_role_test.go b/internal/provider/resource_role_test.go index ad30be24..594fb98c 100644 --- a/internal/provider/resource_role_test.go +++ b/internal/provider/resource_role_test.go @@ -1,16 +1,67 @@ package provider import ( + "context" "fmt" + "log" + "net/http" + "strings" "testing" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/knownvalue" "github.com/hashicorp/terraform-plugin-testing/statecheck" "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" + "github.com/jianyuan/go-utils/ptr" "github.com/rootlyhq/terraform-provider-rootly/v2/internal/acctest" + rootly "github.com/rootlyhq/terraform-provider-rootly/v2/schema" ) +func init() { + resource.AddTestSweepers("rootly_role", &resource.Sweeper{ + Name: "rootly_role", + F: func(region string) error { + ctx := context.Background() + + params := &rootly.ListRolesParams{ + PageNumber: ptr.Ptr(1), + } + + for { + httpResp, err := acctest.SharedClient.ListRolesWithResponse(ctx, params) + if err != nil { + return fmt.Errorf("Error getting roles, got error: %s", err) + } else if httpResp.StatusCode() != http.StatusOK { + return fmt.Errorf("Error getting roles, got status code: %d", httpResp.StatusCode()) + } else if httpResp.ApplicationvndApiJSON200 == nil { + return fmt.Errorf("Error getting roles, got empty response") + } + + for _, role := range httpResp.ApplicationvndApiJSON200.Data { + if strings.HasPrefix(role.Attributes.Name, "tf-") { + httpResp, err := acctest.SharedClient.DeleteRoleWithResponse(ctx, role.Id) + if err != nil { + return fmt.Errorf("Error deleting role: %s", err) + } else if httpResp.StatusCode() != http.StatusOK { + return fmt.Errorf("Error deleting role, got status code: %d", httpResp.StatusCode()) + } + + log.Printf("[INFO] Deleted role %s", role.Attributes.Name) + } + } + + if httpResp.ApplicationvndApiJSON200.Links.Next == nil { + break + } + + params.PageNumber = ptr.Ptr(ptr.Value(params.PageNumber) + 1) + } + + return nil + }, + }) +} + func TestAccResourceRole_UpgradeFromVersion(t *testing.T) { resName := "rootly_role.test" roleName := acctest.RandomWithPrefix("tf-role") diff --git a/internal/provider/resource_team_test.go b/internal/provider/resource_team_test.go index 5caf4f8a..ce23d5a5 100644 --- a/internal/provider/resource_team_test.go +++ b/internal/provider/resource_team_test.go @@ -1,16 +1,67 @@ package provider import ( + "context" "fmt" + "log" + "net/http" + "strings" "testing" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/knownvalue" "github.com/hashicorp/terraform-plugin-testing/statecheck" "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" + "github.com/jianyuan/go-utils/ptr" "github.com/rootlyhq/terraform-provider-rootly/v2/internal/acctest" + rootly "github.com/rootlyhq/terraform-provider-rootly/v2/schema" ) +func init() { + resource.AddTestSweepers("rootly_team", &resource.Sweeper{ + Name: "rootly_team", + F: func(region string) error { + ctx := context.Background() + + params := &rootly.ListTeamsParams{ + PageNumber: ptr.Ptr(1), + } + + for { + httpResp, err := acctest.SharedClient.ListTeamsWithResponse(ctx, params) + if err != nil { + return fmt.Errorf("Error getting teams, got error: %s", err) + } else if httpResp.StatusCode() != http.StatusOK { + return fmt.Errorf("Error getting teams, got status code: %d", httpResp.StatusCode()) + } else if httpResp.ApplicationvndApiJSON200 == nil { + return fmt.Errorf("Error getting teams, got empty response") + } + + for _, team := range httpResp.ApplicationvndApiJSON200.Data { + if strings.HasPrefix(team.Attributes.Name, "tf-") { + httpResp, err := acctest.SharedClient.DeleteTeamWithResponse(ctx, team.Id) + if err != nil { + return fmt.Errorf("Error deleting team: %s", err) + } else if httpResp.StatusCode() != http.StatusOK { + return fmt.Errorf("Error deleting team, got status code: %d", httpResp.StatusCode()) + } + + log.Printf("[INFO] Deleted team %s", team.Attributes.Name) + } + } + + if httpResp.ApplicationvndApiJSON200.Links.Next == nil { + break + } + + params.PageNumber = ptr.Ptr(ptr.Value(params.PageNumber) + 1) + } + + return nil + }, + }) +} + func TestAccResourceTeam_UpgradeFromVersion(t *testing.T) { resName := "rootly_team.test" teamName := acctest.RandomWithPrefix("tf-team") diff --git a/provider/resource_alert_urgency_test.go b/provider/resource_alert_urgency_test.go deleted file mode 100644 index 13f5d878..00000000 --- a/provider/resource_alert_urgency_test.go +++ /dev/null @@ -1,30 +0,0 @@ -// DO NOT MODIFY: This file is generated by tools/generate.js. Any changes will be overwritten during the next build. - -package provider - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" -) - -func TestAccResourceAlertUrgency(t *testing.T) { - resource.UnitTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, - ProviderFactories: providerFactories, - Steps: []resource.TestStep{ - { - Config: testAccResourceAlertUrgency, - }, - }, - }) -} - -const testAccResourceAlertUrgency = ` -resource "rootly_alert_urgency" "test" { - name = "test" -description = "test" -} -`