yugvajani commented on code in PR #17325:
URL: https://github.com/apache/druid/pull/17325#discussion_r1803946175
##########
extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/supervisor/KafkaSupervisorSpecTest.java:
##########
@@ -310,71 +317,115 @@ public void testSerdeWithInputFormat() throws IOException
KafkaSupervisorSpec spec2 = mapper.readValue(serialized,
KafkaSupervisorSpec.class);
String stable = mapper.writeValueAsString(spec2);
+ String sortedStableJson = sortJsonString(stable);
Review Comment:
If an underlying class were using HashSet, other tests in the same file
would likely have failed as well, since they all use the same underlying class.
The key difference with testSerdeWithInputFormat is that it wasn’t using a
parser, which is probably what makes the list order deterministic in the other
tests.
I tried adding the parser to this test, and while it did fix the order, I
ran into an issue where Assert.assertEquals(4,
spec.getDataSchema().getAggregators().length); returned a length of 0. I'm not
entirely sure why, as I’m not very familiar with the Kafka-specific logic.
The sort function I created could be used as a general-purpose tool to
ensure deterministic ordering across tests, if needed. In fact, most of the
tests only rely on assert.contains, except for one AssertEquals. Since the sort
function only arranges the list elements and doesn’t alter their content, it
shouldn’t cause problems, especially since the parser itself was handling
ordering in other cases.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]