Skip to content

Commit

Permalink
Enabling Jacoco Report
Browse files Browse the repository at this point in the history
Signed-off-by: Vamsi Manohar <[email protected]>
  • Loading branch information
vmmusings committed Mar 1, 2023
1 parent 2ddbd20 commit 63f20bd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/sql-test-and-build-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ jobs:
matrix:
entry:
- { os: ubuntu-latest, java: 11 }
- { os: windows-latest, java: 11, os_build_args: -x jacocoTestReport -PbuildPlatform=windows }
- { os: macos-latest, java: 11, os_build_args: -x jacocoTestReport }
- { os: windows-latest, java: 11, os_build_args: -x doctest -PbuildPlatform=windows }
- { os: macos-latest, java: 11}
- { os: ubuntu-latest, java: 17 }
- { os: windows-latest, java: 17, os_build_args: -x jacocoTestReport -PbuildPlatform=windows }
- { os: macos-latest, java: 17, os_build_args: -x jacocoTestReport }
- { os: windows-latest, java: 17, os_build_args: -PbuildPlatform=windows }
- { os: macos-latest, java: 17 }
runs-on: ${{ matrix.entry.os }}

steps:
Expand Down
10 changes: 8 additions & 2 deletions build-tools/sqlplugin-coverage.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* cluster is stopped and dump it to a file. Luckily our current security policy seems to allow this. This will also probably
* break if there are multiple nodes in the integTestCluster. But for now... it sorta works.
*/
import org.apache.tools.ant.taskdefs.condition.Os
apply plugin: 'jacoco'

// Get gradle to generate the required jvm agent arg for us using a dummy tasks of type Test. Unfortunately Elastic's
Expand Down Expand Up @@ -45,7 +46,12 @@ integTest.runner {
}

testClusters.integTest {
jvmArgs " ${dummyIntegTest.jacoco.getAsJvmArg()}"
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
// Replacing build with absolute path to fix the error "error opening zip file or JAR manifest missing : /build/tmp/expandedArchives/..../jacocoagent.jar"
jvmArgs " ${dummyIntegTest.jacoco.getAsJvmArg()}".replace('build',"${buildDir}")
} else {
jvmArgs " ${dummyIntegTest.jacoco.getAsJvmArg()}".replace('javaagent:','javaagent:/')
}
systemProperty 'com.sun.management.jmxremote', "true"
systemProperty 'com.sun.management.jmxremote.authenticate', "false"
systemProperty 'com.sun.management.jmxremote.port', "7777"
Expand All @@ -54,7 +60,7 @@ testClusters.integTest {
}

jacocoTestReport {
dependsOn integTest, test
dependsOn integTest, testF
executionData.from = [dummyTest.jacoco.destinationFile, dummyIntegTest.jacoco.destinationFile]
sourceDirectories.from = sourceSets.main.java.sourceDirectories
classDirectories.from = files(sourceSets.main.java.outputDir)
Expand Down
16 changes: 11 additions & 5 deletions doctest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ task startPrometheus(type: SpawnProcessTask) {

//evaluationDependsOn(':')
task startOpenSearch(type: SpawnProcessTask) {
command "${path}/gradlew -p ${plugin_path} runRestTestCluster"
if( getOSFamilyType() == "windows") {
command "${path}\\gradlew.bat -p ${plugin_path} runRestTestCluster"
}
else {
command "${path}/gradlew -p ${plugin_path} runRestTestCluster"
}
ready 'started'
}

Expand Down Expand Up @@ -94,12 +99,13 @@ task stopPrometheus() {
}
}
}

stopPrometheus.mustRunAfter startPrometheus
if(getOSFamilyType() != "windows") {
stopPrometheus.mustRunAfter startPrometheus
startOpenSearch.dependsOn startPrometheus
stopOpenSearch.finalizedBy stopPrometheus
}
doctest.dependsOn startOpenSearch
startOpenSearch.dependsOn startPrometheus
doctest.finalizedBy stopOpenSearch
stopOpenSearch.finalizedBy stopPrometheus
check.dependsOn doctest
clean.dependsOn(cleanBootstrap)

Expand Down

0 comments on commit 63f20bd

Please sign in to comment.