Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Add test for keyword monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
louy committed Apr 16, 2019
1 parent 9829a5e commit cc8f147
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions uptimerobot/resource_uptimerobot_monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,44 @@ func TestUptimeRobotDataResourceMonitor_http_monitor(t *testing.T) {
})
}

func TestUptimeRobotDataResourceMonitor_keyword_monitor(t *testing.T) {
var FriendlyName = "TF Test: keyword"
var Type = "keyword"
var URL = "https://google.com"
var KeywordType = "not exists"
var KeywordValue = "yahoo"
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckMonitorDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: fmt.Sprintf(`
resource "uptimerobot_monitor" "test" {
friendly_name = "%s"
type = "%s"
url = "%s"
keyword_type = "%s"
keyword_value = "%s"
}
`, FriendlyName, Type, URL, KeywordType, KeywordValue),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("uptimerobot_monitor.test", "friendly_name", FriendlyName),
resource.TestCheckResourceAttr("uptimerobot_monitor.test", "type", Type),
resource.TestCheckResourceAttr("uptimerobot_monitor.test", "url", URL),
resource.TestCheckResourceAttr("uptimerobot_monitor.test", "keyword_type", KeywordType),
resource.TestCheckResourceAttr("uptimerobot_monitor.test", "keyword_value", KeywordValue),
),
},
resource.TestStep{
ResourceName: "uptimerobot_monitor.test",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestUptimeRobotDataResourceMonitor_http_port_monitor(t *testing.T) {
var FriendlyName = "TF Test: http port monitor"
var Type = "port"
Expand Down Expand Up @@ -154,8 +192,8 @@ func TestUptimeRobotDataResourceMonitor_custom_alert_contact_threshold_and_recur
),
},
resource.TestStep{
ResourceName: "uptimerobot_monitor.test",
ImportState: true,
ResourceName: "uptimerobot_monitor.test",
ImportState: true,
// uptimerobot doesn't support pulling alert_contact
// ImportStateVerify: true,
},
Expand Down

0 comments on commit cc8f147

Please sign in to comment.