Copilot commented on code in PR #11628:
URL: https://github.com/apache/gravitino/pull/11628#discussion_r3402124771
##########
flink-connector/flink-common/src/main/java/org/apache/gravitino/flink/connector/catalog/GravitinoCatalogManager.java:
##########
@@ -152,6 +153,17 @@ public void close() {
}
}
+ /**
+ * Get the Gravitino client config, including the authentication entries.
This is used to
+ * propagate authentication to the Iceberg REST catalog backend, which
connects directly to the
+ * Iceberg REST service and therefore needs its own credentials.
+ *
+ * @return The Gravitino client config
+ */
+ public Map<String, String> getGravitinoClientConfig() {
+ return gravitinoClientConfig;
+ }
Review Comment:
getGravitinoClientConfig() returns the internal mutable
gravitinoClientConfig map directly. Callers can accidentally mutate it
(including auth entries), causing hard-to-debug behavior differences later in
the connector. Return a defensive copy instead.
##########
flink-connector/flink-common/src/test/java/org/apache/gravitino/flink/connector/iceberg/TestGravitinoIcebergCatalogFactory.java:
##########
@@ -0,0 +1,194 @@
+/*
+ * 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.flink.connector.iceberg;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import com.google.common.collect.ImmutableMap;
+import java.util.HashMap;
+import java.util.Map;
+import
org.apache.gravitino.flink.connector.store.GravitinoCatalogStoreFactoryOptions;
+import org.apache.iceberg.rest.auth.AuthProperties;
+import org.apache.iceberg.rest.auth.OAuth2Properties;
+import org.junit.jupiter.api.Test;
+
+class TestGravitinoIcebergCatalogFactory {
+
+ @Test
+ void testToRestAuthPropertiesOAuth2() {
+ Map<String, String> clientConfig =
+ ImmutableMap.of(
+ GravitinoCatalogStoreFactoryOptions.AUTH_TYPE,
+ GravitinoCatalogStoreFactoryOptions.OAUTH2,
+ GravitinoCatalogStoreFactoryOptions.OAUTH2_SERVER_URI,
"http://oauth-server",
+ GravitinoCatalogStoreFactoryOptions.OAUTH2_TOKEN_PATH, "/token",
+ GravitinoCatalogStoreFactoryOptions.OAUTH2_CREDENTIAL,
"client:secret",
+ GravitinoCatalogStoreFactoryOptions.OAUTH2_SCOPE, "catalog");
Review Comment:
This new test file appears not to be formatted with the repository’s
Spotless google-java-format settings (e.g., the extra continuation indentation
in the ImmutableMap.of(...) argument list). This will likely fail
`spotlessCheck`; please run Spotless/google-java-format on the whole file to
normalize indentation and line breaks consistently.
--
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]