Skip to content

Commit 3847eeb

Browse files
committed
fix: zap-time-encoding test should allow negative tz offset
The regex used to test whether the times were being properly encoded as ISO8601 only permitted either positive tz offsets or Z. This fix adjusts the regex to also allow negative offsets. Signed-off-by: John Strunk <[email protected]>
1 parent 05aa087 commit 3847eeb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/log/zap/zap_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ var _ = Describe("Zap log level flag options setup", func() {
528528

529529
It("Should propagate time encoder to logger", func() {
530530
// zaps ISO8601TimeEncoder uses 2006-01-02T15:04:05.000Z0700 as pattern for iso8601 encoding
531-
iso8601Pattern := `^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}(\+[0-9]{4}|Z)`
531+
iso8601Pattern := `^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}([-+][0-9]{4}|Z)`
532532

533533
args := []string{"--zap-time-encoding=iso8601"}
534534
fromFlags.BindFlags(&fs)

0 commit comments

Comments
 (0)