Closed malish8632 closed 4 years ago
Do we require strict/stable ordering? I.e. where 2 (or more) identical elements are guaranteed to be put in the same order every time? If so, this test doesn't verify that, unless I'm mistaken.
On Wed, Aug 5, 2020 at 3:04 PM Sergey Rustamov notifications@github.com wrote:
@malish8632 commented on this pull request.
In api/src/test/java/com/spotify/ffwd/util/HighFrequencyDetectorTest.java https://github.com/spotify/ffwd/pull/209#discussion_r465940738:
- for (int i = 0; i < 30; i++) {
- list.add(
- new Metric(
- "KEY" + y,
- 42.0 + i,
- new Date(),
- ImmutableSet.of(),
- Map.of("tag1", "value1", "what", "fun"),
- ImmutableMap.of(),
- null));
- }
- finalList.addAll(detector.detect(list));
- }
- }
- assertEquals(90, finalList.size());
I don't care about sorting itself as long as it is consistent.
— You are receiving this because your review was requested. Reply to this email directly, view it on GitHub https://github.com/spotify/ffwd/pull/209#discussion_r465940738, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKWXWR2DYGULP3DO7U43E3R7GUKXANCNFSM4PVYZJZQ .
--
--
Peter Kingswell
Backend Engineer, Prism Squad
peterk@spotify.com
Brooklyn, NY
+1 646 675 6541
innovative | collaborative | sincere | passionate | playful
@sming the test is not testing what you describe. Also the logic of sorting is in private method, we can't test.
the logic requires the elements to be sorted all the time in the same order. ex:
This is fixing the issue encountered in production where services with high frequency metrics (more than one) stopped sending metrics.
Exception example:
Error in channel, closing java.lang.ClassCastException: class com.spotify.ffwd.model.Metric cannot be cast to class java.lang.Comparable (com.spotify.ffwd.model.Metric is in unnamed module of loader 'app'; java.lang.Comparable is in module java.base of loader 'bootstrap')
@ao2017