From 93a464c9be4f026c33f7747d2bf92382ffa067b3 Mon Sep 17 00:00:00 2001 From: waukin Date: Thu, 12 Dec 2024 21:53:32 +0800 Subject: [PATCH] fix: revert testCatalogDetailsCommand() --- .../integration/test/TableFormatOutputIT.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/clients/cli/src/test/java/org/apache/gravitino/cli/integration/test/TableFormatOutputIT.java b/clients/cli/src/test/java/org/apache/gravitino/cli/integration/test/TableFormatOutputIT.java index 30bf8f6fec6..f23d0284fb2 100644 --- a/clients/cli/src/test/java/org/apache/gravitino/cli/integration/test/TableFormatOutputIT.java +++ b/clients/cli/src/test/java/org/apache/gravitino/cli/integration/test/TableFormatOutputIT.java @@ -178,6 +178,40 @@ public void testCatalogListCommand() { output); } + @Test + public void testCatalogDetailsCommand() { + // Create a byte array output stream to capture the output of the command + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + PrintStream originalOut = System.out; + System.setOut(new PrintStream(outputStream)); + + String[] args = { + "catalog", + "details", + commandArg(GravitinoOptions.METALAKE), + "my_metalake", + commandArg(GravitinoOptions.NAME), + "postgres", + commandArg(GravitinoOptions.OUTPUT), + "table", + commandArg(GravitinoOptions.URL), + gravitinoUrl + }; + Main.main(args); + + // Restore the original System.out + System.setOut(originalOut); + // Get the output and verify it + String output = new String(outputStream.toByteArray(), StandardCharsets.UTF_8).trim(); + assertEquals( + "+----------+------------+-----------------+---------+\n" + + "| catalog | type | provider | comment |\n" + + "+----------+------------+-----------------+---------+\n" + + "| postgres | RELATIONAL | jdbc-postgresql | null |\n" + + "+----------+------------+-----------------+---------+", + output); + } + @Test public void testCatalogDetailsCommandFullCornerCharacter() { ByteArrayOutputStream outputStream = new ByteArrayOutputStream();