Copilot commented on code in PR #10081:
URL: https://github.com/apache/gravitino/pull/10081#discussion_r2871863033


##########
integration-test-common/src/test/java/org/apache/gravitino/integration/test/util/BaseIT.java:
##########
@@ -415,6 +423,8 @@ public void startIntegrationTest() throws Exception {
 
     List<String> authenticators = new ArrayList<>();
     String authenticatorStr = 
customConfigs.get(Configs.AUTHENTICATORS.getKey());
+    LOG.warn("Creating authenticator {}", authenticatorStr);

Review Comment:
   This log is emitted at WARN level for every IT startup and doesn't represent 
an abnormal condition. It also prints the raw authenticator configuration, 
which can be noisy in CI logs. Consider removing it or downgrading to 
DEBUG/INFO.
   ```suggestion
       LOG.info("Creating authenticator {}", authenticatorStr);
   ```



##########
catalogs/catalog-jdbc-mysql/src/test/java/org/apache/gravitino/catalog/mysql/integration/test/CatalogMysqlCredentialIT.java:
##########
@@ -0,0 +1,163 @@
+/*
+ * 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.gravitino.catalog.mysql.integration.test;
+
+import com.google.common.collect.Maps;
+import java.sql.SQLException;
+import java.util.Collections;
+import java.util.Map;
+import org.apache.gravitino.Catalog;
+import org.apache.gravitino.catalog.jdbc.config.JdbcConfig;
+import org.apache.gravitino.client.GravitinoMetalake;
+import org.apache.gravitino.credential.Credential;
+import org.apache.gravitino.credential.JdbcCredential;
+import org.apache.gravitino.integration.test.container.ContainerSuite;
+import org.apache.gravitino.integration.test.container.MySQLContainer;
+import org.apache.gravitino.integration.test.util.BaseIT;
+import org.apache.gravitino.integration.test.util.GravitinoITUtils;
+import org.apache.gravitino.integration.test.util.TestDatabaseName;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Integration test for MySQL catalog credential vending. Tests that JDBC 
credentials can be
+ * retrieved through the credential API.
+ */
+@Tag("gravitino-docker-test")
+public class CatalogMysqlCredentialIT extends BaseIT {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(CatalogMysqlCredentialIT.class);
+  private static final ContainerSuite containerSuite = 
ContainerSuite.getInstance();
+  private static final String provider = "jdbc-mysql";
+  private static final TestDatabaseName TEST_DB_NAME = 
TestDatabaseName.MYSQL_CATALOG_CREDENTIAL_IT;
+
+  private String metalakeName = 
GravitinoITUtils.genRandomName("mysql_credential_metalake");
+  private String catalogName = 
GravitinoITUtils.genRandomName("mysql_credential_catalog");
+  private GravitinoMetalake metalake;
+  private MySQLContainer mysqlContainer;
+
+  @BeforeAll
+  public void startIntegrationTest() {
+    // Do nothing - override to prevent auto start
+  }
+
+  @BeforeAll
+  public void startUp() throws Exception {
+    containerSuite.startMySQLContainer(TEST_DB_NAME);
+    mysqlContainer = containerSuite.getMySQLContainer();
+    super.startIntegrationTest();
+
+    Assertions.assertFalse(client.metalakeExists(metalakeName));
+    metalake = client.createMetalake(metalakeName, "metalake comment", 
Collections.emptyMap());
+    Assertions.assertTrue(client.metalakeExists(metalakeName));
+
+    createCatalog();
+  }
+
+  @AfterAll
+  public void tearDown() {
+    try {
+      if (metalake != null && metalake.catalogExists(catalogName)) {
+        metalake.disableCatalog(catalogName);
+        metalake.dropCatalog(catalogName, true);
+      }
+      if (client != null && client.metalakeExists(metalakeName)) {
+        client.disableMetalake(metalakeName);
+        client.dropMetalake(metalakeName, true);
+      }
+    } finally {
+      if (client != null) {
+        try {
+          client.close();
+        } catch (Exception e) {
+          LOG.error("Exception in closing client", e);
+        }
+        client = null;
+      }
+      try {
+        closer.close();
+      } catch (Exception e) {
+        LOG.error("Exception in closing CloseableGroup", e);
+      }
+    }

Review Comment:
   `tearDown()` closes `closer`, but it never stops the Gravitino server 
started by `super.startIntegrationTest()` (unlike other ITs that call 
`super.stopIntegrationTest()`). This can leave the server running across tests 
and cause port/resource conflicts. Call `super.stopIntegrationTest()` in the 
`finally` block (and rely on that to close the client/cleanup), or otherwise 
explicitly stop MiniGravitino / GravitinoServer as 
`BaseIT.stopIntegrationTest()` does.



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