Skip to content

Commit 2e6469b

Browse files
committed
[bug] used UTC timezone in testcase
1 parent 1cd7cf0 commit 2e6469b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pkg/ottl/ottlfuncs/func_truncate_time_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func Test_TruncateTime(t *testing.T) {
2525
name: "truncate to 1s",
2626
time: &ottl.StandardTimeGetter[any]{
2727
Getter: func(ctx context.Context, tCtx any) (any, error) {
28-
return time.Date(2022, 1, 1, 1, 1, 1, 999999999, time.Local), nil
28+
return time.Date(2022, 1, 1, 1, 1, 1, 999999999, time.UTC), nil
2929
},
3030
},
3131
duration: &ottl.StandardDurationGetter[any]{
@@ -34,13 +34,13 @@ func Test_TruncateTime(t *testing.T) {
3434
return d, nil
3535
},
3636
},
37-
expected: time.Date(2022, 1, 1, 1, 1, 1, 0, time.Local),
37+
expected: time.Date(2022, 1, 1, 1, 1, 1, 0, time.UTC),
3838
},
3939
{
4040
name: "truncate to 1ms",
4141
time: &ottl.StandardTimeGetter[any]{
4242
Getter: func(ctx context.Context, tCtx any) (any, error) {
43-
return time.Date(2022, 1, 1, 1, 1, 1, 999999999, time.Local), nil
43+
return time.Date(2022, 1, 1, 1, 1, 1, 999999999, time.UTC), nil
4444
},
4545
},
4646
duration: &ottl.StandardDurationGetter[any]{
@@ -49,13 +49,13 @@ func Test_TruncateTime(t *testing.T) {
4949
return d, nil
5050
},
5151
},
52-
expected: time.Date(2022, 1, 1, 1, 1, 1, 999000000, time.Local),
52+
expected: time.Date(2022, 1, 1, 1, 1, 1, 999000000, time.UTC),
5353
},
5454
{
5555
name: "truncate old time",
5656
time: &ottl.StandardTimeGetter[any]{
5757
Getter: func(ctx context.Context, tCtx any) (any, error) {
58-
return time.Date(1980, 9, 9, 9, 59, 59, 999999999, time.Local), nil
58+
return time.Date(1980, 9, 9, 9, 59, 59, 999999999, time.UTC), nil
5959
},
6060
},
6161
duration: &ottl.StandardDurationGetter[any]{
@@ -64,7 +64,7 @@ func Test_TruncateTime(t *testing.T) {
6464
return d, nil
6565
},
6666
},
67-
expected: time.Date(1980, 9, 9, 9, 0, 0, 0, time.Local),
67+
expected: time.Date(1980, 9, 9, 9, 0, 0, 0, time.UTC),
6868
},
6969
}
7070
for _, tt := range tests {

0 commit comments

Comments
 (0)