mas-chen commented on code in PR #20: URL: https://github.com/apache/flink-connector-kafka/pull/20#discussion_r1231663375
########## flink-connector-kafka/src/test/java/org/apache/flink/connector/kafka/source/reader/KafkaPartitionSplitReaderTest.java: ########## @@ -319,6 +321,51 @@ public void testUsingCommittedOffsetsWithEarliestOrLatestOffsetResetStrategy( assertThat(reader.consumer().position(partition)).isEqualTo(expectedOffset); } + @Test + public void testConsumerClientRackSupplier() { + AtomicReference<Boolean> supplierCalled = new AtomicReference<>(false); + String rackId = "use1-az1"; + Supplier<String> rackIdSupplier = + () -> { + supplierCalled.set(true); + return rackId; + }; + Properties properties = new Properties(); + createReader( + properties, + UnregisteredMetricsGroup.createSourceReaderMetricGroup(), + rackIdSupplier); + assertThat(supplierCalled.get()).isEqualTo(true); + } + + @ParameterizedTest + @NullAndEmptySource + public void testSetConsumerClientRackIgnoresNullAndEmpty(String rackId) { + Properties properties = new Properties(); + Supplier<String> rackIdSupplier = () -> rackId; + KafkaPartitionSplitReader reader = + createReader( + properties, + UnregisteredMetricsGroup.createSourceReaderMetricGroup(), + rackIdSupplier); + reader.setConsumerClientRack(properties, rackIdSupplier); Review Comment: You can expose a method @VisibleForTesting or use reflection? -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org