Skip to content
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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

morazow
Copy link

@morazow morazow commented Jun 19, 2024

What is the purpose of the change

Brief change log

Verifying this change

  • This change is a trivial rework / code cleanup without any test coverage.
  • Does this pull request potentially affect one of the following parts:
  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API, i.e., is any changed class annotated with @public(Evolving): (no)
  • The serializers: (no)
  • The runtime per-record code paths (performance sensitive): (no)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
  • The S3 file system connector: (no)

Documentation

  • Does this pull request introduce a new feature? no)
  • If yes, how is the feature documented? (not applicable)

Copy link

boring-cyborg bot commented Jun 19, 2024

Thanks for opening this pull request! Please check out our contributing guidelines. (https://flink.apache.org/contributing/how-to-contribute.html)

@snuyanzin
Copy link
Contributor

snuyanzin commented Jun 20, 2024

Thanks for your contribution and driving this activity.
As a first double check that with this PR we have not missed anything, can you please check that the amount of tests before and after is still same?

@morazow
Copy link
Author

morazow commented Jun 20, 2024

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})
Copy link
Contributor

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());
Copy link
Contributor

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());

Comment on lines +172 to +173
assertThatThrownBy(() -> testHarness.processElement(new StreamRecord<>("msg-2")))
.hasStackTraceContaining("artificial async exception");
Copy link
Contributor

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");
Copy link
Contributor

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");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants