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 #54602

Merged
merged 5 commits into from
Apr 2, 2020
Merged

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Apr 1, 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
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (:Analytics/Aggregations)

@nik9000 nik9000 added the >test-failure Triaged test failures from CI label Apr 1, 2020
@nik9000 nik9000 requested a review from hub-cap April 1, 2020 18:09
@nik9000
Copy link
Member Author

nik9000 commented Apr 1, 2020

I don't claim to fully understand how auto date histogram works here, but this test seems much less error prone.

@nik9000
Copy link
Member Author

nik9000 commented Apr 1, 2020

@elasticsearchmachine elasticsearch-ci/packaging-sample-unix-docker

@nik9000
Copy link
Member Author

nik9000 commented Apr 1, 2020

@elasticsearchmachine run elasticsearch-ci/packaging-sample-unix-docker

Copy link
Member

@not-napoleon not-napoleon left a comment

Choose a reason for hiding this comment

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

I think this looks good to merge, but I worry that the test is still brittle. Maybe we can do a follow up, or at least open a ticket, to just add some known value tests to the suite to cover common case. Thanks for fixing this!

@nik9000 nik9000 merged commit 4ce95e4 into elastic:master Apr 2, 2020
@nik9000
Copy link
Member Author

nik9000 commented Apr 2, 2020

Thanks for reviewing @not-napoleon! I'll look into building some more exact test cases that are more readable. Even that is fairly complex.

nik9000 added a commit to nik9000/elasticsearch that referenced this pull request 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 `Instant`s
  so we can read the failures.

Closes elastic#54540
Closes elastic#39497
nik9000 added a commit to nik9000/elasticsearch that referenced this pull request 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 `Instant`s
  so we can read the failures.

Closes elastic#54540
Closes elastic#39497
nik9000 added a commit that referenced this pull request Apr 3, 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 `Instant`s
  so we can read the failures.

Closes #54540
Closes #39497
nik9000 added a commit that referenced this pull request Apr 3, 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 `Instant`s
  so we can read the failures.

Closes #54540
Closes #39497
@jakelandis jakelandis removed the v8.0.0 label Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants