jerryshao commented on code in PR #14963:
URL: https://github.com/apache/gravitino/pull/14963#discussion_r4561877045
##########
NOTICE.bin:
##########
@@ -34,7 +34,7 @@ Apache Iceberg
Copyright 2017-2026 The Apache Software Foundation
Apache Kafka
-Copyright 2011-2023 The Apache Software Foundation
+Copyright 2026 The Apache Software Foundation
Review Comment:
Was this copyright line copied from the NOTICE file inside the kafka-clients
3.9.2 jar? Please make it match that file exactly instead of using the current
year.
##########
catalogs/catalog-kafka/src/test/java/org/apache/gravitino/catalog/kafka/TestKafkaCatalogOperations.java:
##########
@@ -317,6 +318,79 @@ public void testInitialization() throws IOException {
Assertions.assertEquals(DEFAULT_SCHEMA_NAME, schema.name());
}
+ @Test
+ public void testInitializeRejectsConfigProviders() {
+ CatalogEntity catalogEntity =
+ CatalogEntity.builder()
+ .withId(idGenerator.nextId())
+ .withName("test_kafka_catalog_config_providers")
+ .withNamespace(Namespace.of(METALAKE_NAME))
+ .withType(MESSAGING)
+ .withProvider("kafka")
+ .withAuditInfo(
+ AuditInfo.builder()
+ .withCreator("testKafkaUser")
+ .withCreateTime(Instant.now())
+ .build())
+ .withProperties(MOCK_CATALOG_PROPERTIES)
+ .build();
+
+ for (String key :
+ ImmutableList.of(
+ "config.providers",
+ "config.providers.env.class",
+ "config.providers.env.param.allowlist.pattern")) {
+ Map<String, String> properties =
+ ImmutableMap.<String, String>builder()
+ .putAll(MOCK_CATALOG_PROPERTIES)
+ .put("gravitino.bypass." + key, "env")
+ .put("gravitino.bypass.request.timeout.ms", "${env:PATH}")
+ .build();
+ KafkaCatalogOperations ops = new KafkaCatalogOperations(store,
idGenerator);
+ IllegalArgumentException exception =
+ Assertions.assertThrows(
+ IllegalArgumentException.class,
+ () ->
+ ops.initialize(
+ properties, catalogEntity.toCatalogInfo(),
KAFKA_PROPERTIES_METADATA));
+ Assertions.assertTrue(
+ exception.getMessage().contains("gravitino.bypass." + key),
exception.getMessage());
+ // The AdminClient must not be created, and no placeholder may be
resolved or echoed.
+ Assertions.assertNull(ops.adminClientConfig.get("request.timeout.ms"));
+
Assertions.assertFalse(exception.getMessage().contains(System.getenv("PATH")));
Review Comment:
String.contains(null) throws an NPE if PATH is unset in a CI sandbox. Guard
it or use a fixed marker value, since the bypass value is never resolved here
anyway.
--
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]