Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] used UTC timezone in testcase #31798

Merged
merged 2 commits into from Mar 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions pkg/ottl/ottlfuncs/func_truncate_time_test.go
Expand Up @@ -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]{
Expand All @@ -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]{
Expand All @@ -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]{
Expand All @@ -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 {
Expand Down