diff --git a/flink-doris-connector/src/test/java/org/apache/doris/flink/DorisTestBase.java b/flink-doris-connector/src/test/java/org/apache/doris/flink/DorisTestBase.java index d2e71b959..2a33ce589 100644 --- a/flink-doris-connector/src/test/java/org/apache/doris/flink/DorisTestBase.java +++ b/flink-doris-connector/src/test/java/org/apache/doris/flink/DorisTestBase.java @@ -70,8 +70,6 @@ protected static String getFenodes() { @BeforeClass public static void startContainers() { - test("cat /proc/cpuinfo | grep \"cpu cores\" | uniq"); - test("cat /proc/meminfo | grep MemTotal"); LOG.info("Starting doris containers..."); Startables.deepStart(Stream.of(DORIS_CONTAINER)).join(); given().ignoreExceptions() @@ -82,24 +80,6 @@ public static void startContainers() { LOG.info("Containers doris are started."); } - static void test(String cmd) { - try { - Process p = Runtime.getRuntime().exec(cmd); - InputStream is = p.getInputStream(); - BufferedReader reader = new BufferedReader(new InputStreamReader(is)); - String line; - while ((line = reader.readLine()) != null) { - System.out.println(line); - } - p.waitFor(); - is.close(); - reader.close(); - p.destroy(); - } catch (Exception e) { - e.printStackTrace(); - } - } - @AfterClass public static void stopContainers() { LOG.info("Stopping doris containers..."); @@ -167,6 +147,8 @@ private static boolean isBeReady(ResultSet rs, Duration duration) throws SQLExce protected static void printClusterStatus() throws Exception { LOG.info("Current machine IP: {}", InetAddress.getLocalHost()); + echo("sh", "-c", "cat /proc/cpuinfo | grep 'cpu cores' | uniq"); + echo("sh", "-c", "cat /proc/meminfo | grep MemTotal"); try (Connection connection = DriverManager.getConnection( String.format(URL, DORIS_CONTAINER.getHost()), USERNAME, PASSWORD); @@ -178,6 +160,24 @@ protected static void printClusterStatus() throws Exception { } } + static void echo(String... cmd) { + try { + Process p = Runtime.getRuntime().exec(cmd); + InputStream is = p.getInputStream(); + BufferedReader reader = new BufferedReader(new InputStreamReader(is)); + String line; + while ((line = reader.readLine()) != null) { + System.out.println(line); + } + p.waitFor(); + is.close(); + reader.close(); + p.destroy(); + } catch (Exception e) { + e.printStackTrace(); + } + } + private static List convertList(ResultSet rs) throws SQLException { List list = new ArrayList<>(); ResultSetMetaData metaData = rs.getMetaData();