@@ -220,7 +220,7 @@ tasks.register('prepareJacocoAgent', Copy) {
220220// to prevent duplicate -javaagent entries.
221221tasks. named(' test' , Test ) {
222222 // Disable Gradle's default Jacoco injection to avoid transient agent path issues
223- jacoco. enabled = false
223+ jacoco. enabled = true
224224 // Ensure OpenSearch bytecode agent is not attached to unit tests
225225 // Build a classpath that prefers main/test outputs and external deps over the shaded jar
226226 classpath = files(
@@ -232,7 +232,8 @@ tasks.named('test', Test) {
232232 // Remove any opensearch-agent -javaagent from jvmArgs if present
233233 def before = jvmArgs == null ? [] : new ArrayList<String > (jvmArgs)
234234 if (before) {
235- def filtered = before. findAll { ! (it instanceof String && it. contains(' opensearch-agent' )) && ! (it instanceof String && it. startsWith(' -javaagent:' )) }
235+ // Only strip the OpenSearch java agent; keep Jacoco agent intact
236+ def filtered = before. findAll { ! (it instanceof String && it. contains(' opensearch-agent' )) }
236237 if (filtered. size() != before. size()) {
237238 jvmArgs = filtered
238239 }
@@ -440,6 +441,7 @@ task integTest(type: RestIntegTestTask) {
440441tasks. named(" check" ). configure { dependsOn(integTest) }
441442
442443integTest {
444+ jacoco. enabled = true
443445 retry {
444446 if (BuildParams . isCi()) {
445447 maxRetries = 6
@@ -1162,6 +1164,15 @@ jacocoTestCoverageVerification {
11621164check. dependsOn jacocoTestCoverageVerification
11631165jacocoTestCoverageVerification. dependsOn jacocoTestReport
11641166
1167+ jacocoTestReport {
1168+ dependsOn test, integTest
1169+ executionData. from = files(test. jacoco. destinationFile, integTest. jacoco. destinationFile)
1170+ reports {
1171+ xml. required = true
1172+ html. required = true
1173+ }
1174+ }
1175+
11651176compileJava. options. compilerArgs << " -Xlint:-deprecation,-rawtypes,-serial,-try,-unchecked"
11661177
11671178apply plugin : ' com.netflix.nebula.ospackage'
0 commit comments