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 2020/10/06 06:23:33 UTC

[GitHub] [iotdb] samperson1997 commented on a change in pull request #1692: fix some importcsv tool bug

samperson1997 commented on a change in pull request #1692:
URL: https://github.com/apache/iotdb/pull/1692#discussion_r500030975



##########
File path: cross-tests/src/test/java/org/apache/iotdb/cross/tests/tools/importCsv/AbstractScript.java
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iotdb.cross.tests.tools.importCsv;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractScript {
+
+  protected void testOutput(ProcessBuilder builder, String[] output) throws IOException {
+    builder.redirectErrorStream(true);
+    Process p = builder.start();
+    BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
+    String line;
+    List<String> actualOutput = new ArrayList<>();
+    while (true) {
+      line = r.readLine();
+      if (line == null) {
+        break;
+      } else {
+        actualOutput.add(line);
+      }
+    }
+    r.close();
+    p.destroy();
+
+    for (int i = 0; i < output.length; i++) {
+      assertTrue(actualOutput.get(i).startsWith(output[i]));

Review comment:
       Hi, the `ImportCsvTestIT` keeps failing occasionally in windows environment of Travis these days. @Genius-pig could also reproduce this failure in his local PC. Could you please have another check? I created [an issue](https://issues.apache.org/jira/browse/IOTDB-935) in JIRA : )




----------------------------------------------------------------
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.

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