From eb01bc3ca0166ae2b1ed4951ae5966ccab6c926b Mon Sep 17 00:00:00 2001 From: Jade Carino Date: Sun, 16 Jun 2024 15:31:50 +0100 Subject: [PATCH] Add codecoverage for the Kafka plugin Signed-off-by: Jade Carino --- build-locally.sh | 14 ++++++++++++++ .../dev.galasa.events.kafka/build.gradle | 9 +++++++++ 2 files changed, 23 insertions(+) diff --git a/build-locally.sh b/build-locally.sh index 73f89495..3283134c 100755 --- a/build-locally.sh +++ b/build-locally.sh @@ -208,6 +208,19 @@ function displayCouchDbCodeCoverage { info "See html report here: file://${BASEDIR}/galasa-extensions-parent/dev.galasa.ras.couchdb/build/jacocoHtml/index.html" } +function displayKafkaCodeCoverage { + h2 "Calculating Kafka code coverage..." + percent_code_complete=$(cat ${BASEDIR}/galasa-extensions-parent/dev.galasa.events.kafka/build/jacocoHtml/dev.galasa.events.kafka.internal/index.html \ + | sed "s/.*Total<\/td>//1" \ + | cut -f1 -d'%' \ + | sed "s/.*>//g") + info + info + info "Statement code coverage is ${percent_code_complete}%" + info + info "See html report here: file://${BASEDIR}/galasa-extensions-parent/dev.galasa.events.kafka/build/jacocoHtml/index.html" +} + function check_secrets { h2 "updating secrets baseline" cd ${BASEDIR} @@ -235,6 +248,7 @@ function check_secrets { clean_maven_repo build_with_gradle displayCouchDbCodeCoverage +displayKafkaCodeCoverage check_secrets success "Project ${project} built - OK - log is at ${log_file}" \ No newline at end of file diff --git a/galasa-extensions-parent/dev.galasa.events.kafka/build.gradle b/galasa-extensions-parent/dev.galasa.events.kafka/build.gradle index 8237ce71..24f0f501 100644 --- a/galasa-extensions-parent/dev.galasa.events.kafka/build.gradle +++ b/galasa-extensions-parent/dev.galasa.events.kafka/build.gradle @@ -1,6 +1,7 @@ plugins { id 'biz.aQute.bnd.builder' id 'galasa.extensions' + id 'jacoco' } description = 'Galasa Events Plug-In - Kafka' @@ -13,3 +14,11 @@ dependencies { testImplementation(project(':dev.galasa.extensions.mocks')) } + +jacocoTestReport { + reports { + xml.required = true + csv.required = true + html.outputLocation = layout.buildDirectory.dir('jacocoHtml') + } +}