Seeing some failures for make testsuite
for libbeat, that seem to be Timezone related. (My computer is in US Eastern.)
command [go test -cover -coverprofile /tmp/gotestcover-1560318489 github.com/elastic/beats/v7/libbeat/common/fmtstr]: exit status 1
--- FAIL: TestEventFormatString (0.00s)
formatevents_test.go:135: test(0): empty string
formatevents_test.go:135: test(1): no fields configured
formatevents_test.go:135: test(2): expand event field
formatevents_test.go:135: test(3): expand with default
formatevents_test.go:135: test(4): expand nested event field
formatevents_test.go:135: test(5): expand nested event field (alt. syntax)
formatevents_test.go:135: test(6): multiple event fields
formatevents_test.go:135: test(7): same fields
formatevents_test.go:135: test(8): same fields with default (first)
formatevents_test.go:135: test(9): same fields with default (second)
formatevents_test.go:135: test(10): test timestamp formatter
formatevents_test.go:135: test(11): test timestamp formatter
formatevents_test.go:146:
Error Trace: formatevents_test.go:146
Error: Not equal:
expected: "2015-05-01T20:12:34.000Z: 2015.05.01"
actual : "2015-05-02T00:12:34.000Z: 2015.05.01"
Diff:
--- Expected
+++ Actual
@@ -1 +1 @@
-2015-05-01T20:12:34.000Z: 2015.05.01
+2015-05-02T00:12:34.000Z: 2015.05.01
Test: TestEventFormatString
--- FAIL: TestTimestampFormatString (0.00s)
formattimestamp_test.go:89: test(0): empty string
formattimestamp_test.go:89: test(1): no fields configured
formattimestamp_test.go:89: test(2): expand field
formattimestamp_test.go:89: test(3): expand with default
formattimestamp_test.go:89: test(4): expand nested field
formattimestamp_test.go:89: test(5): test timestamp formatter
formattimestamp_test.go:89: test(6): test timestamp formatter
formattimestamp_test.go:106:
Error Trace: formattimestamp_test.go:106
Error: Not equal:
expected: "2015-05-01T20:12:34.000Z: 2015.05.01"
actual : "2015-05-02T00:12:34.000Z: 2015.05.01"
Diff:
--- Expected
+++ Actual
@@ -1 +1 @@
-2015-05-01T20:12:34.000Z: 2015.05.01
+2015-05-02T00:12:34.000Z: 2015.05.01
Test: TestTimestampFormatString
FAIL
coverage: 83.9% of statements
FAIL github.com/elastic/beats/v7/libbeat/common/fmtstr 0.442s
FAIL
and
command [go test -cover -coverprofile /tmp/gotestcover-165778516 github.com/elastic/beats/v7/libbeat/common/fmtstr]: exit status 1
--- FAIL: TestTimestampFormatString (0.00s)
formattimestamp_test.go:89: test(0): empty string
formattimestamp_test.go:89: test(1): no fields configured
formattimestamp_test.go:89: test(2): expand field
formattimestamp_test.go:89: test(3): expand with default
formattimestamp_test.go:89: test(4): expand nested field
formattimestamp_test.go:89: test(5): test timestamp formatter
formattimestamp_test.go:89: test(6): test timestamp formatter
formattimestamp_test.go:106:
Error Trace: formattimestamp_test.go:106
Error: Not equal:
expected: "2015-05-01T20:12:34.000Z: 2015.05.01"
actual : "2015-05-02T00:12:34.000Z: 2015.05.01"
Diff:
--- Expected
+++ Actual
@@ -1 +1 @@
-2015-05-01T20:12:34.000Z: 2015.05.01
+2015-05-02T00:12:34.000Z: 2015.05.01
Test: TestTimestampFormatString
FAIL
coverage: 83.9% of statements
FAIL github.com/elastic/beats/v7/libbeat/common/fmtstr 0.327s
FAIL
For all of these errors, the test code is using time.Local
, but the comparing to a time that is in UTC. That seems like an error in the test suite? Changing to time.UTC
seems to give correct test operation.
I'm happy to make a PR to fix these 4 unit tests. But the contributing guidelines say to create a discussion topic first.