Skip to content

Commit 74fbd50

Browse files
authored
MINOR: Propagate exceptions in TaskMetadataIntegrationTest (#23414)
This PR follows up on the review feedback from #23386 (comment). Two test methods in `TaskMetadataIntegrationTest` caught unexpected exceptions and only printed their stack traces. This prevented those exceptions from reaching JUnit and could allow the tests to be reported as successful. This change removes the catch blocks from `shouldReportCorrectCommittedOffsetInformation` and `shouldReportCorrectEndOffsetInformation`. Both methods now declare `throws Exception`, allowing the original exceptions to propagate to JUnit while retaining the existing try-with-resources cleanup. ### Testing `./gradlew :streams:integration-tests:test --tests org.apache.kafka.streams.integration.TaskMetadataIntegrationTest` Reviewers: Ming-Yen Chung <mingyen066@gmail.com>, Ken Huang <s7133700@gmail.com>
1 parent 4b968c0 commit 74fbd50

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

‎streams/integration-tests/src/test/java/org/apache/kafka/streams/integration/TaskMetadataIntegrationTest.java‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public void setup(final TestInfo testInfo) {
111111
}
112112

113113
@Test
114-
public void shouldReportCorrectCommittedOffsetInformation() {
114+
public void shouldReportCorrectCommittedOffsetInformation() throws Exception {
115115
try (final KafkaStreams kafkaStreams = new KafkaStreams(builder.build(), properties)) {
116116
IntegrationTestUtils.startApplicationAndWaitUntilRunning(kafkaStreams);
117117
final TaskMetadata taskMetadata = getTaskMetadata(kafkaStreams);
@@ -131,13 +131,11 @@ public void shouldReportCorrectCommittedOffsetInformation() {
131131
produceMessages(0L, inputTopic, "test1");
132132
TestUtils.waitForCondition(() -> !process.get(), "The record was not processed");
133133
TestUtils.waitForCondition(() -> taskMetadata.committedOffsets().get(topicPartition) == 3L, "the record was processed");
134-
} catch (final Exception e) {
135-
e.printStackTrace();
136134
}
137135
}
138136

139137
@Test
140-
public void shouldReportCorrectEndOffsetInformation() {
138+
public void shouldReportCorrectEndOffsetInformation() throws Exception {
141139
try (final KafkaStreams kafkaStreams = new KafkaStreams(builder.build(), properties)) {
142140
IntegrationTestUtils.startApplicationAndWaitUntilRunning(kafkaStreams);
143141
final TaskMetadata taskMetadata = getTaskMetadata(kafkaStreams);
@@ -151,9 +149,6 @@ public void shouldReportCorrectEndOffsetInformation() {
151149
process.set(true);
152150
}
153151
assertEquals(9L, taskMetadata.endOffsets().get(topicPartition));
154-
155-
} catch (final Exception e) {
156-
e.printStackTrace();
157152
}
158153
}
159154

0 commit comments

Comments
 (0)