Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-47154][SS][TESTS] Fix
kafka-0-10-sql
to use `ResetSystemProp…
…erties` if `KafkaTestUtils` is used ### What changes were proposed in this pull request? This PR aims to fix `kafka-0-10-sql` module to use `ResetSystemProperties` if `KafkaTestUtils` is used. The following test suites are fixed. - ConsumerStrategySuite - KafkaDataConsumerSuite - KafkaMissingOffsetsTest - KafkaDontFailOnDataLossSuite - KafkaSourceStressForDontFailOnDataLossSuite - KafkaTest - KafkaDelegationTokenSuite - KafkaMicroBatchSourceSuite - KafkaMicroBatchV1SourceWithAdminSuite - KafkaMicroBatchV2SourceWithAdminSuite - KafkaMicroBatchV1SourceSuite - KafkaMicroBatchV2SourceSuite - KafkaSourceStressSuite - KafkaOffsetReaderSuite - KafkaRelationSuite - KafkaRelationSuiteWithAdminV1 - KafkaRelationSuiteWithAdminV2 - KafkaRelationSuiteV1 - KafkaRelationSuiteV2 - KafkaSinkSuite - KafkaSinkMicroBatchStreamingSuite - KafkaContinuousSinkSuite - KafkaSinkBatchSuiteV1 - KafkaSinkBatchSuiteV2 ### Why are the changes needed? Apache Spark `master` branch has two `KafkaTestUtils` classes. ``` $ find . -name KafkaTestUtils.scala ./connector/kafka-0-10-sql/src/test/scala/org/apache/spark/sql/kafka010/KafkaTestUtils.scala ./connector/kafka-0-10/src/test/scala/org/apache/spark/streaming/kafka010/KafkaTestUtils.scala ``` `KafkaTestUtils` of `kafka-0-10-sql` uses `System.setProperty` and affects 8 files. We need to use `ResetSystemProperties` to isolate the test cases. https://github.com/apache/spark/blob/ee312ecb40ea5b5303fc794a3d494b6f27cda923/connector/kafka-0-10-sql/src/test/scala/org/apache/spark/sql/kafka010/KafkaTestUtils.scala#L290 ``` $ git grep KafkaTestUtils connector/kafka-0-10-sql | awk -F: '{print $1}' | sort | uniq connector/kafka-0-10-sql/src/test/resources/log4j2.properties connector/kafka-0-10-sql/src/test/scala/org/apache/spark/sql/kafka010/ConsumerStrategySuite.scala connector/kafka-0-10-sql/src/test/scala/org/apache/spark/sql/kafka010/KafkaDelegationTokenSuite.scala connector/kafka-0-10-sql/src/test/scala/org/apache/spark/sql/kafka010/KafkaDontFailOnDataLossSuite.scala connector/kafka-0-10-sql/src/test/scala/org/apache/spark/sql/kafka010/KafkaMicroBatchSourceSuite.scala connector/kafka-0-10-sql/src/test/scala/org/apache/spark/sql/kafka010/KafkaOffsetReaderSuite.scala connector/kafka-0-10-sql/src/test/scala/org/apache/spark/sql/kafka010/KafkaRelationSuite.scala connector/kafka-0-10-sql/src/test/scala/org/apache/spark/sql/kafka010/KafkaSinkSuite.scala connector/kafka-0-10-sql/src/test/scala/org/apache/spark/sql/kafka010/KafkaTestUtils.scala connector/kafka-0-10-sql/src/test/scala/org/apache/spark/sql/kafka010/consumer/KafkaDataConsumerSuite.scala ``` ### Does this PR introduce _any_ user-facing change? No. This is a test-only PR. ### How was this patch tested? Pass the CIs. ### Was this patch authored or co-authored using generative AI tooling? No. Closes apache#45239 from dongjoon-hyun/SPARK-47154. Authored-by: Dongjoon Hyun <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
- Loading branch information