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 InternalAutoDateHistogramTests (backport of #54602) #54688

Merged
merged 1 commit into from
Apr 3, 2020

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Apr 2, 2020

The test had errors around time units that have different length - think
leap years or months that aren't 30 days. This fixes those errors. In
the proces I've changed a bunch of things to debug the problem:

  • Replace currentTimeMillis with a random time. Now the test fails
    randomly! Wonderful. Much better than on random days of the month.
  • Generate buckets "closer together" to test random reduction. Without
    this we were super frequently getting stuck in the "year of century"
    rounding because some of the of the buckets we built were far apart.
    This generates a much greater variety of tests.
  • Implement toString on RoundingInfo so I can debug without going
    crazy.
  • Switch keys in the bucket assertions from epoch millis to Instants
    so we can read the failures.

Closes #54540
Closes #39497

The test had errors around time units that have different length - think
leap years or months that aren't 30 days. This fixes those errors. In
the proces I've changed a bunch of things to debug the problem:

* Replace `currentTimeMillis` with a random time. Now the test fails
  randomly! Wonderful. Much better than on random days of the month.
* Generate buckets "closer together" to test random reduction. Without
  this we were super frequently getting stuck in the "year of century"
  rounding because *some* of the of the buckets we built were far apart.
  This generates a much greater variety of tests.
* Implement `toString` on `RoundingInfo` so I can debug without going
  crazy.
* Switch keys in the bucket assertions from epoch millis to `Instant`s
  so we can read the failures.

Closes elastic#54540
Closes elastic#39497
@nik9000 nik9000 merged commit 38f4b03 into elastic:7.7 Apr 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant