Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
wardviaene committed Sep 24, 2024
1 parent 17651d9 commit e69ddda
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pkg/observability/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,16 @@ func TestGetLogs(t *testing.T) {
}

func TestFloatToDate(t *testing.T) {
now := time.Now()
floatDate := float64(now.Unix()) + float64(now.Nanosecond())/1e9
floatToDate := floatToDate(floatDate)
if !now.Equal(floatToDate) {
t.Fatalf("times are not equal. Got: %s, expected: %s", floatToDate, now)
for i := 0; i < 10; i++ {
now := time.Now()
floatDate := float64(now.Unix()) + float64(now.Nanosecond())/1e9
floatToDate := floatToDate(floatDate)
if now.Unix() != floatToDate.Unix() {
t.Fatalf("times are not equal. Got: %v, expected: %v", floatToDate, now)
}
if now.UnixNano() != floatToDate.UnixNano() {
t.Fatalf("times are not equal. Got: %v, expected: %v", floatToDate, now)
}
}
}

Expand Down

0 comments on commit e69ddda

Please sign in to comment.