From e69dddae591d20280d1dcc948af2eefc5a6acd18 Mon Sep 17 00:00:00 2001 From: Edward Viaene Date: Mon, 23 Sep 2024 21:07:45 -0500 Subject: [PATCH] fix test --- pkg/observability/logs_test.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pkg/observability/logs_test.go b/pkg/observability/logs_test.go index 9d11a47..17847ef 100644 --- a/pkg/observability/logs_test.go +++ b/pkg/observability/logs_test.go @@ -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) + } } }