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

Fix the flaky test testExtractDatePartWithTimeType() #3225

Merged
merged 4 commits into from
Jan 8, 2025

Conversation

LantaoJin
Copy link
Member

@LantaoJin LantaoJin commented Dec 30, 2024

Description

Flaky test:

ExtractTest > testExtractDatePartWithTimeType() FAILED
    org.opentest4j.AssertionFailedError: expected: <53> but was: <1>
        at app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
        at app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
        at app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
        at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
        at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
        at app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:635)
        at app//org.opensearch.sql.expression.datetime.ExtractTest.datePartWithTimeArgQuery(ExtractTest.java:90)
        at app//org.opensearch.sql.expression.datetime.ExtractTest.testExtractDatePartWithTimeType(ExtractTest.java:98)

Caused by function extract(WEEK FROM ...) actually returns the number of the ISO 8601 week-of-week-based-year:

A week is considered to start on a Monday and week 1 is the first week with >3 days. In the ISO week-numbering system, it is possible for early-January dates to be part of the 52nd or 53rd week of the previous year, and for late-December dates to be part of the first week of the next year. For example, 2005-01-02 is part of the 53rd week of year 2004, while 2012-12-31 is part of the first week of 2013.

So the current expected number 53 in the test day 2024-12-30 is incorrect.

The fixing is skipping the testing in December and January.

Related Issues

Resolves #3224

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • New functionality has javadoc added.
  • New functionality has a user manual doc added.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

YANG-DB
YANG-DB previously approved these changes Dec 30, 2024
Copy link
Member

@YANG-DB YANG-DB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

@LantaoJin LantaoJin marked this pull request as draft December 30, 2024 03:32
Signed-off-by: Lantao Jin <[email protected]>
@LantaoJin LantaoJin changed the title Fix the failure test testExtractDatePartWithTimeType() Fix the flaky test testExtractDatePartWithTimeType() Dec 30, 2024
Signed-off-by: Lantao Jin <[email protected]>
@LantaoJin LantaoJin marked this pull request as ready for review December 30, 2024 04:30
@LantaoJin LantaoJin requested a review from YANG-DB December 30, 2024 04:43
@LantaoJin LantaoJin added the flaky-test Flaky build or test issue label Dec 30, 2024
@LantaoJin
Copy link
Member Author

LantaoJin commented Dec 31, 2024

gentle ping @YANG-DB @dai-chen @penghuo @noCharger @ykmr1224 . Currently, CI failures in almost PRs relates to this issue.

@LantaoJin
Copy link
Member Author

LantaoJin commented Jan 8, 2025

Seems there is an open issue #2477 and provided a temporary fix for similar another tests which are not including this one.

@YANG-DB YANG-DB merged commit 0e4acd3 into opensearch-project:main Jan 8, 2025
16 of 17 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 8, 2025
* Fix the failure test testExtractDatePartWithTimeType()

Signed-off-by: Lantao Jin <[email protected]>

* skip test week with time type in Jan and Dec

Signed-off-by: Lantao Jin <[email protected]>

* add doc

Signed-off-by: Lantao Jin <[email protected]>

* fix incorrect format

Signed-off-by: Lantao Jin <[email protected]>

---------

Signed-off-by: Lantao Jin <[email protected]>
(cherry picked from commit 0e4acd3)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
LantaoJin pushed a commit that referenced this pull request Jan 9, 2025
* Fix the failure test testExtractDatePartWithTimeType()



* skip test week with time type in Jan and Dec



* add doc



* fix incorrect format



---------


(cherry picked from commit 0e4acd3)

Signed-off-by: Lantao Jin <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x flaky-test Flaky build or test issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG][TEST] Flaky test testExtractDatePartWithTimeType
3 participants