From 2e6469bb9b2cbeb747b29fe2d6e9e838acdf4b90 Mon Sep 17 00:00:00 2001 From: Prithvipal Singh Date: Sun, 17 Mar 2024 22:19:49 +0530 Subject: [PATCH] [bug] used UTC timezone in testcase --- pkg/ottl/ottlfuncs/func_truncate_time_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/ottl/ottlfuncs/func_truncate_time_test.go b/pkg/ottl/ottlfuncs/func_truncate_time_test.go index 33781d3b478eb..626fdd831ea08 100644 --- a/pkg/ottl/ottlfuncs/func_truncate_time_test.go +++ b/pkg/ottl/ottlfuncs/func_truncate_time_test.go @@ -25,7 +25,7 @@ func Test_TruncateTime(t *testing.T) { name: "truncate to 1s", time: &ottl.StandardTimeGetter[any]{ Getter: func(ctx context.Context, tCtx any) (any, error) { - return time.Date(2022, 1, 1, 1, 1, 1, 999999999, time.Local), nil + return time.Date(2022, 1, 1, 1, 1, 1, 999999999, time.UTC), nil }, }, duration: &ottl.StandardDurationGetter[any]{ @@ -34,13 +34,13 @@ func Test_TruncateTime(t *testing.T) { return d, nil }, }, - expected: time.Date(2022, 1, 1, 1, 1, 1, 0, time.Local), + expected: time.Date(2022, 1, 1, 1, 1, 1, 0, time.UTC), }, { name: "truncate to 1ms", time: &ottl.StandardTimeGetter[any]{ Getter: func(ctx context.Context, tCtx any) (any, error) { - return time.Date(2022, 1, 1, 1, 1, 1, 999999999, time.Local), nil + return time.Date(2022, 1, 1, 1, 1, 1, 999999999, time.UTC), nil }, }, duration: &ottl.StandardDurationGetter[any]{ @@ -49,13 +49,13 @@ func Test_TruncateTime(t *testing.T) { return d, nil }, }, - expected: time.Date(2022, 1, 1, 1, 1, 1, 999000000, time.Local), + expected: time.Date(2022, 1, 1, 1, 1, 1, 999000000, time.UTC), }, { name: "truncate old time", time: &ottl.StandardTimeGetter[any]{ Getter: func(ctx context.Context, tCtx any) (any, error) { - return time.Date(1980, 9, 9, 9, 59, 59, 999999999, time.Local), nil + return time.Date(1980, 9, 9, 9, 59, 59, 999999999, time.UTC), nil }, }, duration: &ottl.StandardDurationGetter[any]{ @@ -64,7 +64,7 @@ func Test_TruncateTime(t *testing.T) { return d, nil }, }, - expected: time.Date(1980, 9, 9, 9, 0, 0, 0, time.Local), + expected: time.Date(1980, 9, 9, 9, 0, 0, 0, time.UTC), }, } for _, tt := range tests {