Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] DateTimeUtilsTest.getConvertDurationIncludingMonthUnit() tests are timezone dependent #12970

Closed
2 tasks done
bdemers opened this issue Jul 18, 2024 · 1 comment · Fixed by #12971
Closed
2 tasks done

Comments

@bdemers
Copy link
Member

bdemers commented Jul 18, 2024

Search before asking

  • I searched in the issues and found nothing similar.

Version

1.3.3-SNAPSHOT

Describe the bug and provide the minimal reproduce step

Set your timezone to UTC-4 (or anything UTC-* probably), and run the tests...

What did you expect to see?

Passing tests

What did you see instead?

failing tests

Anything else?

TL;DR: Adding a month to a date is problematic, depending on the TZ you are in.

Copied from slack:

I'm running the IoTDB UT's locally, (all the tests that are included in the default profiles, e.g. mvn clean install)
All the tests pass except one in DateTimeUtilsTest
https://ge.apache.org/s/rd4tbdzopz2ju/tests/goal/org.apache.iotdb:iotdb-server:sure[…]IncludingMonthUnit?expanded-stacktrace=WyIwIl0&top-execution=1

Other than commented most of that test method, any ideas to work around/fix it?
(i'm not ruling out user error either)

Well... it's a TZ issue. I'm currently UTC -4, if I set my timezone to UTC or something +, the test seem to pass.
5097600000 in my TZ is Feb 28th, plus one month is March 28,
Using UTC, it's March 1st, plus one month is April 1st

Are you willing to submit a PR?

  • I'm willing to submit a PR!
Copy link

Hi, this is your first issue in IoTDB project. Thanks for your report. Welcome to join the community!

bdemers added a commit to bdemers/iotdb that referenced this issue Jul 18, 2024
DateTimeUtilsTest.getConvertDurationIncludingMonthUnit() uses dates conversions that are TZ specfic.
Wrapping the test in a session, allows this single test to use a set timezone, while not affecting the behavior of other tests

Fixes: apache#12970
@HTHou HTHou closed this as completed in b527e06 Jul 19, 2024
JackieTien97 pushed a commit that referenced this issue Jul 22, 2024
DateTimeUtilsTest.getConvertDurationIncludingMonthUnit() uses dates conversions that are TZ specfic.
Wrapping the test in a session, allows this single test to use a set timezone, while not affecting the behavior of other tests

Fixes: #12970
(cherry picked from commit b527e06)
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 a pull request may close this issue.

1 participant