Skip to content

RANGER-5754: Fix timezone-sensitive test failures in MiscUtilTest - #1173

Open
ChinmayHegde24 wants to merge 2 commits into
apache:masterfrom
ChinmayHegde24:RANGER-5754
Open

RANGER-5754: Fix timezone-sensitive test failures in MiscUtilTest#1173
ChinmayHegde24 wants to merge 2 commits into
apache:masterfrom
ChinmayHegde24:RANGER-5754

Conversation

@ChinmayHegde24

@ChinmayHegde24 ChinmayHegde24 commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Description:
Timezone-dependent unit test failures found in MiscUtilTest (failure outside UTC)
mainly in testGetFormattedTime and testGetUTCDateForLocalDate.

Fix
testGetFormattedTime: Replaced hardcoded "2021-01-01" with an expected value generated by the same SimpleDateFormat logic as production, so the test uses JVM local timezone and stays timezone-agnostic.

testGetUTCDateForLocalDate: Fixed incorrect DST offset in MiscUtil.getUTCDateForLocalDate and StringUtil.getUTCDateForLocalDate causing test failure outside UTC timezones

Test:
Successful build
Successful run with both

mvn clean -Duser.timezone=America/New_York test &
mvn clean -Duser.timezone=UTC test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants