-
Notifications
You must be signed in to change notification settings - Fork 881
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
Convert camel-2.20 Groovy tests to Java #8813
Convert camel-2.20 Groovy tests to Java #8813
Conversation
...gent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachecamel/RestCamelTest.java
Outdated
Show resolved
Hide resolved
import org.springframework.boot.SpringApplication; | ||
import org.springframework.context.ConfigurableApplicationContext; | ||
|
||
public class SingleServiceCamelTest extends RetryOnAddressAlreadyInUse { |
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.
In tests that use http server and need a client to test it with we usually use https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpServerUsingTest.java Up to you to decide whether it would help you.
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.
thank you for this recommendation, i was able to remove the additional dependency on okhttp by switching to this
...st/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/CassandraTest.java
Outdated
Show resolved
Hide resolved
...st/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/CassandraTest.java
Outdated
Show resolved
Hide resolved
...st/java/io/opentelemetry/javaagent/instrumentation/apachecamel/decorators/CassandraTest.java
Outdated
Show resolved
Hide resolved
...gent/src/test/java/io/opentelemetry/javaagent/instrumentation/apachecamel/RestCamelTest.java
Outdated
Show resolved
Hide resolved
...pentelemetry/javaagent/instrumentation/apachecamel/TwoServicesWithDirectClientCamelTest.java
Outdated
Show resolved
Hide resolved
…race relation assertion, remove retryonaddressalreadyinuse
…race relation assertion, remove retryonaddressalreadyinuse
span.hasName("input") | ||
.hasKind(SpanKind.INTERNAL) | ||
.hasNoParent() | ||
.hasAttribute(stringKey("camel.uri"), "direct://input"), |
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.
It would be better to use hasAttributesSatisfyingExactly
instead of hasAttribute
, groovy tests also verify that all attributes are asserted.
hasAttributesSatisfyingExactly(equalTo(stringKey("camel.uri"), "direct://input")))
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.
thank you for the recommendation, I have updated accordingly
span.hasName("GET /api/{module}/unit/{unitId}") | ||
.hasKind(SpanKind.SERVER) | ||
.hasParent(trace.getSpan(1)) | ||
.hasAttributesSatisfying( |
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.
if possible use hasAttributesSatisfyingExactly
@jaydeluca looks good. See if you can replace the usages of |
…ests, update all hasAttributes to hasAttributesSatisfyingExactly
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.
Thanks @jaydeluca !
thank you @laurit and @mateuszrzeszutek for taking the time to review and provide guidance, I appreciate it |
Related to #7195
This PR converts the primary test package and decorators from groovy to Java for the camel-2.20 instrumentation.
A few notes:
Thank you for your consideration of my contribution