Skip to content

Commit

Permalink
update the test to do field checking
Browse files Browse the repository at this point in the history
  • Loading branch information
platinummonkey committed May 16, 2019
1 parent 2d975df commit ff48760
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions integration/downtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ func TestDowntimeLinkedToMonitorCreateAndDelete(t *testing.T) {
func TestDowntimeUpdate(t *testing.T) {

downtime := createTestDowntime(t)
originalID := int(downtime.GetId())

// changing the scope will cause the downtime to be replaced in the future
// this test should be updated to validate this
downtime.Scope = []string{"env:downtime_test", "env:downtime_test2"}
defer cleanUpDowntime(t, *downtime.Id)

Expand All @@ -65,8 +68,22 @@ func TestDowntimeUpdate(t *testing.T) {
t.Fatalf("Retrieving a downtime failed when it shouldn't: %s", err)
}

assert.Equal(t, downtime, actual)

// uncomment once immutable to validate it changed to NotEqual
assert.Equal(t, originalID, actual.GetId())
assert.Equal(t, downtime.GetActive(), acutal.GetActive())
assert.Equal(t, downtime.GetCancelled(), acutal.GetCancelled())
assert.Equal(t, downtime.GetDisabled(), acutal.GetDisabled())
assert.Equal(t, downtime.GetEnd(), acutal.GetEnd())
assert.Equal(t, downtime.GetMessage(), acutal.GetMessage())
assert.Equal(t, downtime.GetMonitorId(), acutal.GetMonitorId())
assert.Equal(t, downtime.GetMonitorTags(), acutal.GetMonitorTags())
assert.Equal(t, downtime.GetParentId(), acutal.GetParentId())
// timezone will be automatically updated to UTC
assert.Equal(t, "utc", actual.GetTimezone())
assert.Equal(t, downtime.GetRecurrence(), acutal.GetRecurrence())
assert.EqualValues(t, downtime.Scope, acutal.Scope)
// in the future the replaced downtime will have an updated start time, flip this to NotEqual
assert.Equal(t, downtime.GetStart(), actual.GetStart())
}

func TestDowntimeGet(t *testing.T) {
Expand Down

0 comments on commit ff48760

Please sign in to comment.