Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JNSimba committed Mar 5, 2024
1 parent e30edee commit 6f1e383
Showing 1 changed file with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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...");
Expand Down Expand Up @@ -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);
Expand All @@ -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<Map> convertList(ResultSet rs) throws SQLException {
List<Map> list = new ArrayList<>();
ResultSetMetaData metaData = rs.getMetaData();
Expand Down

0 comments on commit 6f1e383

Please sign in to comment.