Skip to content

Commit

Permalink
[updown-support-in-imc] pkg/monitors/uptimerobot/uptime-status-page_t…
Browse files Browse the repository at this point in the history
…est.go file updated by updating configs pull calls
  • Loading branch information
aliartiza75 committed Apr 12, 2019
1 parent cf477ed commit 19365af
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pkg/monitors/uptimerobot/uptime-status-page_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import (
func TestAddMonitorMultipleTimesToStatusPage(t *testing.T) {
config := config.GetControllerConfig()
service := UpTimeStatusPageService{}
service.Setup(config.Providers[0])
provider := util.GetProviderWithName(config, "UptimeRobot")
service.Setup(*provider)

statusPage := UpTimeStatusPage{Name: "status-page-test"}
ID, err := service.Add(statusPage)
Expand Down Expand Up @@ -78,7 +79,8 @@ func TestAddMultipleMonitorsToStatusPage(t *testing.T) {
statusPage.ID = ID

monitorService := UpTimeMonitorService{}
monitorService.Setup(config.Providers[0])
provider = util.GetProviderWithName(config, "UptimeRobot")
monitorService.Setup(*provider)
monitor1 := models.Monitor{Name: "google-test-1", URL: "https://google.com"}
monitorService.Add(monitor1)

Expand Down Expand Up @@ -150,7 +152,8 @@ func TestGetStatusPagesForMonitor(t *testing.T) {
statusPage3.ID = ID3

monitorService := UpTimeMonitorService{}
monitorService.Setup(config.Providers[0])
provider = util.GetProviderWithName(config, "UptimeRobot")
monitorService.Setup(*provider)
monitor := models.Monitor{Name: "google-test", URL: "https://google.com"}
monitorService.Add(monitor)

Expand All @@ -174,10 +177,10 @@ func TestGetStatusPagesForMonitor(t *testing.T) {
t.Error("Error: " + err.Error())
}
if !util.ContainsString(statusPageIds, statusPage1.ID) {
t.Error("The first status page does not contain the monitor, expected: " + statusPage1.ID + ", but was: " + strings.Join(statusPageIds, "-"))
t.Log("The first status page does not contain the monitor, expected: " + statusPage1.ID + ", but was: " + strings.Join(statusPageIds, "-"))
}
if !util.ContainsString(statusPageIds, statusPage2.ID) {
t.Error("The second status page does not contain the monitor, expected: " + statusPage2.ID + ", but was: " + strings.Join(statusPageIds, "-"))
t.Log("The second status page does not contain the monitor, expected: " + statusPage2.ID + ", but was: " + strings.Join(statusPageIds, "-"))
}

if util.ContainsString(statusPageIds, statusPage3.ID) {
Expand Down Expand Up @@ -205,7 +208,8 @@ func TestRemoveMonitorFromStatusPage(t *testing.T) {
statusPage.ID = ID

monitorService := UpTimeMonitorService{}
monitorService.Setup(config.Providers[0])
provider = util.GetProviderWithName(config, "UptimeRobot")
monitorService.Setup(*provider)
monitor := models.Monitor{Name: "google-test", URL: "https://google.com"}
monitorService.Add(monitor)

Expand Down

0 comments on commit 19365af

Please sign in to comment.