You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/04/21 20:28:36 UTC

[GitHub] [iotdb] MarcyGO commented on a diff in pull request #5564: Change assertion to prevent SchemaBuilderTest from failing due to indeterminate ordering

MarcyGO commented on code in PR #5564:
URL: https://github.com/apache/iotdb/pull/5564#discussion_r855568234


##########
tsfile/src/test/java/org/apache/iotdb/tsfile/write/schema/converter/SchemaBuilderTest.java:
##########
@@ -65,10 +68,13 @@ public void testJsonConverter1() {
     String[] tsDesStrings = {
       "[s4,DOUBLE,RLE,{max_point_number=3},SNAPPY]", "[s5,INT32,TS_2DIFF,,UNCOMPRESSED]"
     };
-    int i = 0;
+    Set<String> expected = new HashSet<String>(Arrays.asList(tsDesStrings));
+    List<String> actual = new ArrayList<String>();
     for (IMeasurementSchema desc : timeseries) {
-      assertEquals(tsDesStrings[i++], desc.toString());
+      actual.add(desc.toString());
     }
+    assertEquals(expected.size(), actual.size());
+    assertEquals(expected, new HashSet<String>(actual));

Review Comment:
   Thanks for your question. 
   First, `nondex` doesn't shuffle lists because they have a specific iteration order. Second, the assertion compares two sets rather than two lists precisely to avoid the dependency on the order. 



-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org