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][TEST] Flaky test testExtractDatePartWithTimeType #3224

Closed
LantaoJin opened this issue Dec 30, 2024 · 0 comments · Fixed by #3225
Closed

[BUG][TEST] Flaky test testExtractDatePartWithTimeType #3224

LantaoJin opened this issue Dec 30, 2024 · 0 comments · Fixed by #3225
Assignees
Labels
bug Something isn't working flaky-test Flaky build or test issue testing Related to improving software testing

Comments

@LantaoJin
Copy link
Member

LantaoJin commented Dec 30, 2024

What is the bug?
The test testExtractDatePartWithTimeType is failed today (2024-12-30)

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.

How can one reproduce the bug?

POST /_plugins/_sql
{
  "query" : """
  select extract(WEEK FROM "2024-12-30 10:11:12") from opensearch_dashboards_sample_data_logs limit 1
  """
}

Returns 1.

What is the expected behavior?
The testExtractDatePartWithTimeType() expected: <53> but was: <1>

What is your host/environment?

  • OS: [e.g. iOS]
  • Version [e.g. 22]
  • Plugins

Do you have any screenshots?
If applicable, add screenshots to help explain your problem.

Do you have any additional context?
Add any other context about the problem.

@LantaoJin LantaoJin added bug Something isn't working untriaged flaky-test Flaky build or test issue testing Related to improving software testing and removed untriaged labels Dec 30, 2024
@LantaoJin LantaoJin changed the title [BUG][TEST] Fix the failure test testExtractDatePartWithTimeType [BUG][TEST] Flaky test testExtractDatePartWithTimeType Dec 30, 2024
@LantaoJin LantaoJin self-assigned this Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working flaky-test Flaky build or test issue testing Related to improving software testing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant