-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathstatus_update_template_resource_test.go
48 lines (41 loc) · 1.19 KB
/
status_update_template_resource_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
package provider
import (
"fmt"
"testing"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)
func TestAccFireHydrantStatusUpdateTemplate_basic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testFireHydrantIsSetup(t) },
ProviderFactories: defaultProviderFactories(),
Steps: []resource.TestStep{
{
Config: testAccFireHydrantStatusUpdateTemplateConfigBasic(),
Check: resource.ComposeTestCheckFunc(
testAccCheckFireHydrantStatusUpdateTemplateExists("firehydrant_status_update_template.test"),
),
},
},
})
}
func testAccFireHydrantStatusUpdateTemplateConfigBasic() string {
return `
resource "firehydrant_status_update_template" "test" {
name = "test-signal-rule"
body = "This is the template body"
}
`
}
func testAccCheckFireHydrantStatusUpdateTemplateExists(resourceName string) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[resourceName]
if !ok {
return fmt.Errorf("resource not found: %s", resourceName)
}
if rs.Primary.ID == "" {
return fmt.Errorf("no resource ID is set")
}
return nil
}
}