-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FLINK-25538][Connectors/Kafka] Migration flink-connector-kafka from Junit4 to Junit5 #106
base: main
Are you sure you want to change the base?
Conversation
Thanks for opening this pull request! Please check out our contributing guidelines. (https://flink.apache.org/contributing/how-to-contribute.html) |
Thanks for your contribution and driving this activity. |
Hey @snuyanzin, thanks for the feedback! I did quick grep, on the previous PR (#66) it is 398 tests, and in this PR it is 429. Current PR is already main rebased so expected more tests. I couldn't run the whole build locally yet, but I'll check again once I am successful. |
@@ -47,33 +48,34 @@ | |||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | |||
|
|||
/** Tests for {@link KafkaRecordSerializationSchemaBuilder}. */ | |||
public class KafkaRecordSerializationSchemaBuilderTest extends TestLogger { | |||
@ExtendWith({TestLoggerExtension.class}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC we don't need to put each time this ExtendsWith
for almost every test
instead just put it once in services (common practice in different flink modules) like e.g. here
https://github.com/apache/flink/blob/e3b123d7d1e48e7adbb04fb3470d02bb76f5ff73/flink-formats/flink-avro-confluent-registry/src/test/resources/META-INF/services/org.junit.jupiter.api.extension.Extension#L16
|
||
FlinkKafkaInternalProducer<?, ?> firstProducer = | ||
committable.getProducer().get().getObject(); | ||
assertThat(firstProducer != writer.getCurrentProducer()) | ||
.as("Expected different producer") | ||
.isTrue(); | ||
.isNotSameAs(writer.getCurrentProducer()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like a wrong statement which always will pass the test since firstProducer != writer.getCurrentProducer()
is always is not same as writer.getCurrentProducer()
I guess the correct one should be
assertThat(firstProducer)
.as("Expected different producer")
.isNotSameAs(writer.getCurrentProducer());
assertThatThrownBy(() -> testHarness.processElement(new StreamRecord<>("msg-2"))) | ||
.hasStackTraceContaining("artificial async exception"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here it is not one-to-one migration since it's started to check the, whole trace instead of just a cause
fail("unknown failure"); | ||
// the next invoke should rethrow the async exception | ||
assertThatThrownBy(() -> testHarness.snapshot(123L, 123L)) | ||
.hasStackTraceContaining("artificial async exception"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
fail("unknown failure"); | ||
// the snapshot should have failed with the async exception | ||
assertThatThrownBy(() -> snapshotThread.sync()) | ||
.hasStackTraceContaining("artificial async failure for 2nd message"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
What is the purpose of the change
Brief change log
Verifying this change
Documentation