diff --git a/utils/coreutils_test.go b/utils/coreutils_test.go index 1f223e987..382c2eca3 100644 --- a/utils/coreutils_test.go +++ b/utils/coreutils_test.go @@ -828,9 +828,11 @@ func TestEndOfMonth(t *testing.T) { if !eom.Equal(expected) { t.Errorf("Expected %v was %v", expected, eom) } + // Date ref represents zero time instant, will return time.Now(). eom = GetEndOfMonth(time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC)) - if time.Now().Add(-1).Before(eom) { - t.Errorf("Expected %v was %v", expected, eom) + if currentDateRef := time.Now(); currentDateRef.Before(eom) || + time.Since(eom) > time.Millisecond { + t.Errorf("Expected GetEndOfMonth to return the current date info, received: %s", eom) } }