kevinw66 commented on code in PR #11903:
URL: https://github.com/apache/gravitino/pull/11903#discussion_r3570021210


##########
clients/client-java/src/test/java/org/apache/gravitino/client/TestFunctionCatalog.java:
##########
@@ -151,6 +152,51 @@ public void testListFunctions() throws 
JsonProcessingException {
         "internal error");
   }
 
+  @Test
+  public void testListFunctionInfos() throws JsonProcessingException {
+    NameIdentifier func1 = NameIdentifier.of("schema1", "func1");
+    String functionPath =
+        withSlash(formatFunctionRequestPath(Namespace.of(metalakeName, 
catalogName, "schema1")));
+    FunctionDTO[] mockFunctions =
+        new FunctionDTO[] {
+          mockFunctionDTO("func1", FunctionType.SCALAR, "mock comment1", true),
+          mockFunctionDTO("func2", FunctionType.SCALAR, "mock comment2", true)
+        };
+
+    FunctionListResponse resp = new FunctionListResponse(mockFunctions);
+    buildMockResource(
+        Method.GET, functionPath, ImmutableMap.of("details", "true"), null, 
resp, SC_OK);
+
+    Function[] functions = 
catalog.asFunctionCatalog().listFunctionInfos(func1.namespace());
+    Assertions.assertEquals(2, functions.length);
+    assertFunction(mockFunctions[0], functions[0]);
+    assertFunction(mockFunctions[1], functions[1]);
+
+    // Throw schema not found exception
+    ErrorResponse errResp =
+        ErrorResponse.notFound(NoSuchSchemaException.class.getSimpleName(), 
"schema not found");
+    buildMockResource(
+        Method.GET, functionPath, ImmutableMap.of("details", "true"), null, 
errResp, SC_NOT_FOUND);
+    Assertions.assertThrows(
+        NoSuchSchemaException.class,
+        () -> catalog.asFunctionCatalog().listFunctionInfos(func1.namespace()),
+        "schema not found");
+
+    // Throw Runtime exception
+    ErrorResponse errResp2 = ErrorResponse.internalError("internal error");
+    buildMockResource(
+        Method.GET,
+        functionPath,
+        ImmutableMap.of("details", "true"),
+        null,
+        errResp2,
+        SC_SERVER_ERROR);
+    Assertions.assertThrows(
+        RuntimeException.class,
+        () -> catalog.asFunctionCatalog().listFunctionInfos(func1.namespace()),
+        "internal error");
+  }

Review Comment:
   You're right. I noticed that listFunctionInfos had no unit test while 
updating FunctionCatalogOperations, so I added one to cover the existing 
behavior. It is not directly related to tag support, and I can remove it from 
this PR if preferred.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to