-
Notifications
You must be signed in to change notification settings - Fork 324
Update tests to run with JUnit 5 #9445
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
Changes from 36 commits
b51891f
fb23244
6195dc7
dadece6
6bd53b0
ee37411
cc364ab
952eb06
6a5561f
8e7b825
96285e4
b37d536
b3600f1
1285825
90ff66f
092091e
6f45038
3df713f
e09ea5c
cc30b04
d0e2740
7c2ec00
f582dc8
f4c259a
17f661b
2b923ec
f8e440a
4cf11b4
70ff95a
bea85ff
e602a2d
2a5479b
b5f73cf
ef9f98d
6fb4423
4459ff3
0ee9943
dacb913
73f4895
57315bd
7ff7d47
0681bb5
11cb5b2
7836c1e
ef488c9
b281647
240ba4d
f75a988
95abf16
94a3be7
679fa0c
c803820
70348ec
450d944
65b8e63
42ed209
78ae232
d9ddbc4
525333c
46cd888
ff52d3b
f88ddf8
c50b95f
fd7a0d5
42599ea
c427898
6b1df6f
36f5715
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Since this actually a fixture, I would suggest to rename these project as fixture, e.g. Also, it might be useful to have a README here or some comment in the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On a side note maybe we can craft a simple plugin similar to In particular something that doesn't do component.addVariantsFromConfiguration(feature.getRuntimeElementsConfiguration(), new JavaConfigurationVariantMapping("runtime", true, feature.getRuntimeClasspathConfiguration()));
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After sleeping on it, I'm not sure that creating a plugin would bring much value there. So let's drop the idea of a custom plugin.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Renamed as suggested, and added
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| apply from: "$rootDir/gradle/java.gradle" | ||
| apply from: "$rootDir/gradle/version.gradle" | ||
|
|
||
| dependencies { | ||
| api project(':dd-java-agent:instrumentation-testing') | ||
| api project(':dd-java-agent:agent-ci-visibility:civisibility-testing') | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| apply from: "$rootDir/gradle/java.gradle" | ||
| apply from: "$rootDir/gradle/version.gradle" | ||
|
|
||
| dependencies { | ||
| api project(':dd-java-agent:agent-ci-visibility') | ||
| api project(':dd-java-agent:testing') | ||
| api project(':utils:test-utils') | ||
|
|
||
| api group: 'org.skyscreamer', name: 'jsonassert', version: '1.5.1' | ||
| api group: 'org.freemarker', name: 'freemarker', version: '2.3.31' | ||
| api group: 'com.jayway.jsonpath', name: 'json-path', version: '2.8.0' | ||
| api group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.16.0' | ||
| api group: 'org.msgpack', name: 'jackson-dataformat-msgpack', version: '0.9.6' | ||
| api group: 'org.xmlunit', name: 'xmlunit-core', version: '2.10.3' | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| apply from: "$rootDir/gradle/java.gradle" | ||
| apply from: "$rootDir/gradle/version.gradle" | ||
|
|
||
| dependencies { | ||
| api project(':dd-java-agent:agent-iast') | ||
| api project(':dd-java-agent:instrumentation-testing') | ||
| api project(':utils:test-utils') | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| apply from: "$rootDir/gradle/java.gradle" | ||
| apply from: "$rootDir/gradle/version.gradle" | ||
|
|
||
| dependencies { | ||
| api project(':dd-java-agent:appsec') | ||
| api project(':dd-java-agent:instrumentation-testing') | ||
| api project(':utils:test-utils') | ||
| } | ||
|
|
||
| configurations.api { | ||
| exclude group: 'org.eclipse.jetty', module: 'jetty-server' | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| apply from: "$rootDir/gradle/java.gradle" | ||
|
|
||
| dependencies { | ||
| api libs.bytebuddy | ||
| api libs.bytebuddyagent | ||
| api libs.slf4j | ||
| api libs.bundles.spock | ||
| api libs.bundles.test.logging | ||
| api libs.guava | ||
|
|
||
| api project(':dd-java-agent:testing') | ||
|
|
||
| implementation project(':dd-java-agent:agent-debugger') | ||
|
|
||
| implementation 'org.junit.platform:junit-platform-runner:1.9.0' | ||
|
|
||
| testImplementation project(':utils:test-utils') | ||
| testImplementation project(':dd-java-agent:instrumentation:trace-annotation') | ||
|
|
||
| testImplementation group: 'cglib', name: 'cglib', version: '3.2.5' | ||
| // test instrumenting java 1.1 bytecode | ||
| testImplementation group: 'net.sf.jt400', name: 'jt400', version: '6.1' | ||
AlexeyKuznetsov-DD marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // We have autoservices defined in test subtree, looks like we need this to be able to properly rebuild this | ||
| testAnnotationProcessor libs.autoservice.processor | ||
| testCompileOnly libs.autoservice.annotation | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ import datadog.trace.agent.test.datastreams.RecordingDatastreamsPayloadWriter | |
| import datadog.trace.agent.tooling.AgentInstaller | ||
| import datadog.trace.agent.tooling.InstrumenterModule | ||
| import datadog.trace.agent.tooling.TracerInstaller | ||
| import datadog.trace.agent.tooling.bytebuddy.matcher.ClassLoaderMatchers | ||
| import datadog.trace.agent.tooling.bytebuddy.matcher.GlobalIgnores | ||
| import datadog.trace.api.Config | ||
| import datadog.trace.api.DDSpanId | ||
|
|
@@ -66,7 +67,7 @@ import net.bytebuddy.dynamic.DynamicType | |
| import net.bytebuddy.utility.JavaModule | ||
| import okhttp3.HttpUrl | ||
| import okhttp3.OkHttpClient | ||
| import org.junit.runner.RunWith | ||
| import org.junit.jupiter.api.extension.ExtendWith | ||
| import org.slf4j.Logger | ||
| import org.slf4j.LoggerFactory | ||
| import org.spockframework.mock.MockUtil | ||
|
|
@@ -107,7 +108,7 @@ import static datadog.trace.util.AgentThreadFactory.AgentThread.TASK_SCHEDULER | |
| */ | ||
| // CodeNarc incorrectly thinks ".class" is unnecessary in @RunWith | ||
| @SuppressWarnings('UnnecessaryDotClass') | ||
| @RunWith(SpockRunner.class) | ||
| @ExtendWith(SpockExtension.class) | ||
| abstract class AgentTestRunner extends DDSpecification implements AgentBuilder.Listener { | ||
bric3 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| private static final long TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(20) | ||
|
|
||
|
|
@@ -462,6 +463,10 @@ abstract class AgentTestRunner extends DDSpecification implements AgentBuilder.L | |
| spiedAgentSpan | ||
| } | ||
|
|
||
| // if a test enables the instrumentation it verifies, | ||
| // the cache needs to be recomputed taking into account that instrumentation's matchers | ||
| ClassLoaderMatchers.resetState() | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: I wonder if this make sense to move to the SpockExtension ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not against moving it, but why do you think the extension is a better place?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry this was before splitting
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, it is in the |
||
| assert ServiceLoader.load(InstrumenterModule, AgentTestRunner.getClassLoader()) | ||
| .iterator() | ||
| .hasNext(): "No instrumentation found" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.