test(internal): Try multiple timezone abbrevations (#14854)

This commit is contained in:
Joshua Powers 2024-02-20 15:36:38 -05:00 committed by GitHub
parent f081b2c830
commit b19389533c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -759,10 +759,16 @@ func TestTimestampAbbrevWarning(t *testing.T) {
log.SetOutput(&buf)
defer log.SetOutput(backup)
// Try multiple timestamps with abbreviated timezones in case a user
// is actually in one of the timezones.
ts, err := ParseTimestamp("RFC1123", "Mon, 02 Jan 2006 15:04:05 MST", nil)
require.NoError(t, err)
require.EqualValues(t, 1136239445, ts.Unix())
ts2, err := ParseTimestamp("RFC1123", "Mon, 02 Jan 2006 15:04:05 EST", nil)
require.NoError(t, err)
require.EqualValues(t, 1136232245, ts2.Unix())
require.Contains(t, buf.String(), "Your config is using abbreviated timezones and parsing was changed in v1.27.0")
}