Fixed flaky tests in CompatParquetReaderTest.java with ObjectMapper#2
Open
Fixed flaky tests in CompatParquetReaderTest.java with ObjectMapper#2
Conversation
|
Have you checked if any existing dependency has the ability to compare JSON strings? I saw |
| try { | ||
| JSONAssert.assertEquals(expectedJson, DEFAULT_JSON_WRITER.writeValueAsString(sampled.get(0).getRawValues()), false); | ||
| } | ||
| catch (JSONException jse) { |
There was a problem hiding this comment.
What is the reason for adding try-catch blocks? I see that you are any way throwing RuntimeException in catch block, what is the use of changing the type of exception
f221526 to
44eaeb7
Compare
d3b51aa to
ffb77be
Compare
ffb77be to
b8c57d5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixed flaky tests in CompatParquetReaderTest.java with ObjectMapper
druid/extensions-core/parquet-extensions/src/test/java/org/apache/druid/data/input/parquet/CompatParquetReaderTest.java
Line 43 in ad32f84
Test:
testBinaryAsString,testParquetThriftCompat,testReadNestedArrayStruct,testProtoStructWithArraySteps to Reproduce:
The following is an example error message from
testReadNestedArrayStructReason of flakiness:
These tests check the equality of two JSON strings. The data reading methods used
createReader()in those tests do not retrieve data in a consistent order, which can possibly lead to different JSON representations of the same data during test runs.Changes:
fasterxml.jacksonpackage, and changed from using standard assertion methodAssertto usingJSONNodeandObjectMapper, which parse two JSON strings and convert them to a tree structure and each node in the trees are compared. Thus, the order of the elements in JSON strings is deterministic and the test passes.Release note
Fixed:
CompatParquetReaderTesttests no longer fail when running with the NonDex tool.This PR has: