From de0a916043324f45a025eb07f57b370297bdf33d Mon Sep 17 00:00:00 2001 From: Alan Hinchliff Date: Fri, 15 Oct 2021 09:46:57 -0400 Subject: [PATCH] #28472 fix flaky tests in libbeat fmtstr to use time.UTC instead of time.Local --- libbeat/common/fmtstr/formatevents_test.go | 4 ++-- libbeat/common/fmtstr/formattimestamp_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libbeat/common/fmtstr/formatevents_test.go b/libbeat/common/fmtstr/formatevents_test.go index 6e78eb5713f9..a644676db754 100644 --- a/libbeat/common/fmtstr/formatevents_test.go +++ b/libbeat/common/fmtstr/formatevents_test.go @@ -109,7 +109,7 @@ func TestEventFormatString(t *testing.T) { "test timestamp formatter", "%{[key]}: %{+YYYY.MM.dd}", beat.Event{ - Timestamp: time.Date(2015, 5, 1, 20, 12, 34, 0, time.Local), + Timestamp: time.Date(2015, 5, 1, 20, 12, 34, 0, time.UTC), Fields: common.MapStr{ "key": "timestamp", }, @@ -121,7 +121,7 @@ func TestEventFormatString(t *testing.T) { "test timestamp formatter", "%{[@timestamp]}: %{+YYYY.MM.dd}", beat.Event{ - Timestamp: time.Date(2015, 5, 1, 20, 12, 34, 0, time.Local), + Timestamp: time.Date(2015, 5, 1, 20, 12, 34, 0, time.UTC), Fields: common.MapStr{ "key": "timestamp", }, diff --git a/libbeat/common/fmtstr/formattimestamp_test.go b/libbeat/common/fmtstr/formattimestamp_test.go index 4df8e6b3fdc1..1a2c91decdd5 100644 --- a/libbeat/common/fmtstr/formattimestamp_test.go +++ b/libbeat/common/fmtstr/formattimestamp_test.go @@ -73,14 +73,14 @@ func TestTimestampFormatString(t *testing.T) { "test timestamp formatter", "%{[key]}: %{+YYYY.MM.dd}", common.MapStr{"key": "timestamp"}, - time.Date(2015, 5, 1, 20, 12, 34, 0, time.Local), + time.Date(2015, 5, 1, 20, 12, 34, 0, time.UTC), "timestamp: 2015.05.01", }, { "test timestamp formatter", "%{[@timestamp]}: %{+YYYY.MM.dd}", common.MapStr{"key": "timestamp"}, - time.Date(2015, 5, 1, 20, 12, 34, 0, time.Local), + time.Date(2015, 5, 1, 20, 12, 34, 0, time.UTC), "2015-05-01T20:12:34.000Z: 2015.05.01", }, }