Skip to content

Commit 346672f

Browse files
Test against new karate groupId (#11210)
# What Does This Do - Updates build file for karate instrumentation to use the updated `io.karatelabs` groupId when resolving latest versions instead of the old `com.intuit.karate`. - Adds a test target for the latest version released under the old groupId # Motivation - Better testing coverage # Additional Notes With the new groupId, Karate has also released a new major 2.x version. Support for this version will come in a followup PR as it will probably require major changes to the instrumentation. test-environment-trigger: skip # Contributor Checklist - Format the title according to [the contribution guidelines](https://github.com/DataDog/dd-trace-java/blob/master/CONTRIBUTING.md#title-format) - Assign the `type:` and (`comp:` or `inst:`) labels in addition to [any other useful labels](https://github.com/DataDog/dd-trace-java/blob/master/CONTRIBUTING.md#labels) - Avoid using `close`, `fix`, or [any linking keywords](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) when referencing an issue Use `solves` instead, and assign the PR [milestone](https://github.com/DataDog/dd-trace-java/milestones) to the issue - Update the [CODEOWNERS](https://github.com/DataDog/dd-trace-java/blob/master/.github/CODEOWNERS) file on source file addition, migration, or deletion - Update [public documentation](https://docs.datadoghq.com/tracing/trace_collection/library_config/java/) with any new configuration flags or behaviors Jira ticket: [PROJ-IDENT] ***Note:*** **Once your PR is ready to merge, add it to the merge queue by commenting `/merge`.** `/merge -c` cancels the queue request. `/merge -f --reason "reason"` skips all merge queue checks; please use this judiciously, as some checks do not run at the PR-level. For more information, see [this doc](https://datadoghq.atlassian.net/wiki/spaces/DEVX/pages/3121612126/MergeQueue). <!-- # Opening vs Drafting a PR: When opening a pull request, please open it as a draft to not auto assign reviewers before you feel the pull request is in a reviewable state. # Linking a JIRA ticket: Please link your JIRA ticket by adding its identifier between brackets (ex [PROJ-IDENT]) in the PR description, not the title. This requirement only applies to Datadog employees. --> Co-authored-by: daniel.mohedano <daniel.mohedano@datadoghq.com>
1 parent a7ad565 commit 346672f

2 files changed

Lines changed: 258 additions & 161 deletions

File tree

dd-java-agent/instrumentation/karate-1.0/build.gradle

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,20 @@ muzzle {
1717
versions = '[1.4.0,)'
1818
javaVersion = 11
1919
}
20+
// Karate 1.5.0+ is published under io.karatelabs and compiled with Java 17
21+
pass {
22+
group = 'io.karatelabs'
23+
module = 'karate-core'
24+
versions = '[1.5.0,2.0.0)'
25+
javaVersion = 17
26+
}
2027
}
2128

2229
addTestSuiteForDir('latestDepTest', 'test')
2330
// karate 1.3.1 is the last version supporting Java 8.
2431
addTestSuiteForDir('karate131Test', 'test')
32+
// karate 1.4.1 is the last release on the com.intuit.karate groupId (Java 11).
33+
addTestSuiteForDir('karate141Test', 'test')
2534

2635
dependencies {
2736
compileOnly group: 'com.intuit.karate', name: 'karate-core', version: '1.0.0'
@@ -48,16 +57,34 @@ dependencies {
4857
exclude group: 'ch.qos.logback', module: 'logback-classic'
4958
}
5059

51-
latestDepTestImplementation (group: 'com.intuit.karate', name: 'karate-core', version: '+') {
60+
karate141TestImplementation (group: 'com.intuit.karate', name: 'karate-core', version: '1.4.1') {
5261
// excluding logback to avoid conflicts with libs.bundles.test.logging
5362
exclude group: 'ch.qos.logback', module: 'logback-classic'
5463
}
55-
latestDepTestImplementation (group: 'com.intuit.karate', name: 'karate-junit5', version: '+') {
64+
karate141TestImplementation (group: 'com.intuit.karate', name: 'karate-junit5', version: '1.4.1') {
65+
// excluding logback to avoid conflicts with libs.bundles.test.logging
66+
exclude group: 'ch.qos.logback', module: 'logback-classic'
67+
}
68+
69+
// Karate 1.5.0+ is published under io.karatelabs. Bound below 2.0.0 because Karate 2.x
70+
// is a ground-up rewrite and does not publish karate-junit5.
71+
// TODO: implement support for karate 2.x
72+
latestDepTestImplementation (group: 'io.karatelabs', name: 'karate-core', version: '[1.5.0,2.0.0)') {
73+
// excluding logback to avoid conflicts with libs.bundles.test.logging
74+
exclude group: 'ch.qos.logback', module: 'logback-classic'
75+
}
76+
latestDepTestImplementation (group: 'io.karatelabs', name: 'karate-junit5', version: '[1.5.0,2.0.0)') {
5677
// excluding logback to avoid conflicts with libs.bundles.test.logging
5778
exclude group: 'ch.qos.logback', module: 'logback-classic'
5879
}
5980
}
6081

82+
// latestDepTest extends test (see gradle/test-suites.gradle), which pulls in com.intuit.karate
83+
// 1.0.0. Drop the legacy coordinate so it does not collide with io.karatelabs on the classpath.
84+
configurations.latestDepTestImplementation {
85+
exclude group: 'com.intuit.karate'
86+
}
87+
6188
// Using recommended Karate project layout where Karate feature files sit in same /test/java folders as their java counterparts
6289
sourceSets {
6390
test {
@@ -72,6 +99,12 @@ sourceSets {
7299
exclude '**/*.java'
73100
}
74101
}
102+
karate141Test {
103+
resources {
104+
srcDir file('src/test/java')
105+
exclude '**/*.java'
106+
}
107+
}
75108
latestDepTest {
76109
resources {
77110
srcDir file('src/test/java')
@@ -80,11 +113,18 @@ sourceSets {
80113
}
81114
}
82115

83-
tasks.named("compileLatestDepTestJava", JavaCompile) {
116+
// karate 1.4.0+ requires Java 11: https://github.com/karatelabs/karate/releases/tag/v1.4.0
117+
tasks.named("compileKarate141TestJava", JavaCompile) {
84118
configureCompiler(it, 11, JavaVersion.VERSION_1_8)
85119
}
120+
tasks.named("karate141Test", Test) {
121+
onlyIf { javaVersion.isJava11Compatible() }
122+
}
123+
124+
tasks.named("compileLatestDepTestJava", JavaCompile) {
125+
configureCompiler(it, 17, JavaVersion.VERSION_1_8)
126+
}
86127

87-
// karate 1.4.0+ requires Java 11: https://github.com/karatelabs/karate/releases/tag/v1.4.0
88128
tasks.named("latestDepTest", Test) {
89-
onlyIf { javaVersion.isJava11Compatible() }
129+
onlyIf { javaVersion >= JavaVersion.VERSION_17 }
90130
}

0 commit comments

Comments
 (0)