Skip to content

Convert kafka-clients unit test from groovy to java #7770

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

Merged
merged 7 commits into from
Feb 13, 2023
Merged

Convert kafka-clients unit test from groovy to java #7770

merged 7 commits into from
Feb 13, 2023

Conversation

cuichenli
Copy link
Contributor

No description provided.

wip
wip

wip

clean
@cuichenli cuichenli requested a review from a team February 9, 2023 07:05
Copy link
Member

@mateuszrzeszutek mateuszrzeszutek left a comment

Choose a reason for hiding this comment

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

I left a couple of comments, they're mostly about minor style issues. Overall it looks great, thanks @cuichenli !

Comment on lines 66 to 67
testing.waitForTraces(1);
testing.waitAndAssertTraces(
Copy link
Member

Choose a reason for hiding this comment

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

The waitAndAssertTraces() method already waits for 1 completed trace, there should be no need to call waitForTraces() explicitly

Suggested change
testing.waitForTraces(1);
testing.waitAndAssertTraces(
testing.waitAndAssertTraces(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed most testing.waitForTraces but kept two where there is no testing.waitAndAssertTraces

@cuichenli
Copy link
Contributor Author

@mateuszrzeszutek thanks for your comments, updated accordingly. please take a look again. thanks!

Copy link
Member

@mateuszrzeszutek mateuszrzeszutek left a comment

Choose a reason for hiding this comment

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

Thanks @cuichenli !

@mateuszrzeszutek
Copy link
Member

The latest dep version tests are failing against an errorprone warning

/home/runner/work/opentelemetry-java-instrumentation/opentelemetry-java-instrumentation/instrumentation/kafka/kafka-clients/kafka-clients-0.11/javaagent/src/test/java/io/opentelemetry/instrumentation/kafkaclients/KafkaClientDefaultTest.java:74: warning: [PreferJavaTimeOverload] If the numeric primitive (Duration.ofSeconds(5).toMillis()) represents a Duration, please call consumer.poll(Duration) instead.
    ConsumerRecords<?, ?> records = consumer.poll(Duration.ofSeconds(5).toMillis());
                                                 ^
    (see https://errorprone.info/bugpattern/PreferJavaTimeOverload)

You might want to add @SuppressWarnings("PreferJavaTimeOverload") whenever poll(long) is called

@cuichenli
Copy link
Contributor Author

@mateuszrzeszutek thanks, all the tests passed

@mateuszrzeszutek mateuszrzeszutek merged commit d3326db into open-telemetry:main Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants