Change assertion to prevent IoTDBInterpreterTest from failing due to indeterminate ordering#5666
Closed
faaple wants to merge 2 commits intoapache:masterfrom
faaple:fix_IoTDBInterpreterTest
Closed
Change assertion to prevent IoTDBInterpreterTest from failing due to indeterminate ordering#5666faaple wants to merge 2 commits intoapache:masterfrom faaple:fix_IoTDBInterpreterTest
faaple wants to merge 2 commits intoapache:masterfrom
faaple:fix_IoTDBInterpreterTest
Conversation
jixuan1989
reviewed
Apr 30, 2022
| List<String> actualList = new ArrayList<String>(Arrays.asList(actual.split("\n"))); | ||
| List<String> expectedList = new ArrayList<String>(Arrays.asList(gt.split("\n"))); | ||
| Assert.assertEquals(expectedList.get(0), actualList.get(0)); | ||
| Assert.assertEquals(new HashSet<String>(expectedList), new HashSet<String>(actualList)); |
Member
There was a problem hiding this comment.
This modification has a benifit that we can know which line of results are incorrect.
However, IMO, it is sensitive about the order of the resultset table.
So, using Hashset to compare the result is not very good.
We may need to use ArrayList to split the result and compare them line by line.
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.
Some tests in the class
org.apache.zeppelin.iotdb.IoTDBInterpreterTestcan fail based on the order of iteration inConcurrentHashMap. These tests aretestShowTimeseries,testShowDevices,testShowDevicesWithSg,testShowAllTTL, andtestShowStorageGroup.I found the issue using NonDex:
The test can fail because it assumes that the order of the data is determinate, and can be fixed it by ignoring the order.