-
Bug
-
Resolution: Unresolved
-
Critical
-
None
Jacoco plugin ignores minimum***Coverage options and sets it to 0 when maximum***Coverage weren't set.
We call Jacoco this way (pipeline stage step)
jacoco(execPattern: '**/*.exec', changeBuildStatus: true, exclusionPattern: '**/*Test*.class', inclusionPattern: '**/*.class', minimumMethodCoverage: '10')
But in log I see this:
Health thresholds: JacocoHealthReportThresholds [minClass=0, maxClass=0, minMethod=0, maxMethod=0, minLine=0, maxLine=0, minBranch=0, maxBranch=0, minInstruction=0, maxInstruction=0, minComplexity=0, maxComplexity=0]
On the other side, in case when jacoco calls this way (we've added maximumMethodCoverage option):
jacoco(execPattern: '**/*.exec', changeBuildStatus: true, exclusionPattern: '**/*Test*.class', inclusionPattern: '**/*.class', minimumMethodCoverage: '10', maximumMethodCoverage: '80')
And in log something new:
Thresholds: JacocoHealthReportThresholds [minClass=0, maxClass=0, minMethod=10, maxMethod=80, minLine=0, maxLine=0, minBranch=0, maxBranch=0, minInstruction=0, maxInstruction=0, minComplexity=0, maxComplexity=0]
Probably, issue in the class JacocoHealthReportThresholds (package hudson.plugins.jacoco) in method public void ensureValid(), e.g.:
- maxClass was parsed as 0 (not set) and applyRange returns 0 ;
- minClass was set to 10 and applyRange is called with params 0, 10, 0 and return 0 .
[JENKINS-54773] Jacoco plugin 3.0.4 ignores minimum****Coverage options
Description |
Original:
Jacoco plugin ignores minimum****Coverage options and sets it to 0 when maximum****Coverage weren't set. We call Jacoco this way (pipeline stage step) {code:java} jacoco(execPattern: '**/*.exec', changeBuildStatus: true, exclusionPattern: '**/*Test*.class', inclusionPattern: '**/*.class', minimumMethodCoverage: '10'){code} But in log I see this: Health thresholds: JacocoHealthReportThresholds [minClass=0, maxClass=0, minMethod=0, maxMethod=0, minLine=0, maxLine=0, minBranch=0, maxBranch=0, minInstruction=0, maxInstruction=0, minComplexity=0, maxComplexity=0] On the other side, in case when jacoco calls this way (we've added maximumMethodCoverage option): {code:java} jacoco(execPattern: '**/*.exec', changeBuildStatus: true, exclusionPattern: '**/*Test*.class', inclusionPattern: '**/*.class', minimumMethodCoverage: '10', maximumMethodCoverage: '80') {code} And in log something new: {code:java} Thresholds: JacocoHealthReportThresholds [minClass=0, maxClass=0, minMethod=10, maxMethod=80, minLine=0, maxLine=0, minBranch=0, maxBranch=0, minInstruction=0, maxInstruction=0, minComplexity=0, maxComplexity=0]{code} Probably, issue in the class JacocoHealthReportThresholds (package hudson.plugins.jacoco) in method public void ensureValid(), e.g.: # maxClass was parsed as 0 (not set) and applyRange returns 0 ; # minClass was set to 10 and applyRange is called with params 0, 10, 0 and return 0 . See: https://github.com/jenkinsci/jacoco-plugin/blob/master/src/main/java/hudson/plugins/jacoco/JacocoHealthReportThresholds.java#L49-L59 |
New:
Jacoco plugin ignores minimum****Coverage options and sets it to 0 when maximum****Coverage weren't set. We call Jacoco this way (pipeline stage step) {code:java} jacoco(execPattern: '**/*.exec', changeBuildStatus: true, exclusionPattern: '**/*Test*.class', inclusionPattern: '**/*.class', minimumMethodCoverage: '10'){code} But in log I see this: {code:java} Health thresholds: JacocoHealthReportThresholds [minClass=0, maxClass=0, minMethod=0, maxMethod=0, minLine=0, maxLine=0, minBranch=0, maxBranch=0, minInstruction=0, maxInstruction=0, minComplexity=0, maxComplexity=0]{code} On the other side, in case when jacoco calls this way (we've added maximumMethodCoverage option): {code:java} jacoco(execPattern: '**/*.exec', changeBuildStatus: true, exclusionPattern: '**/*Test*.class', inclusionPattern: '**/*.class', minimumMethodCoverage: '10', maximumMethodCoverage: '80') {code} And in log something new: {code:java} Thresholds: JacocoHealthReportThresholds [minClass=0, maxClass=0, minMethod=10, maxMethod=80, minLine=0, maxLine=0, minBranch=0, maxBranch=0, minInstruction=0, maxInstruction=0, minComplexity=0, maxComplexity=0]{code} Probably, issue in the class JacocoHealthReportThresholds (package hudson.plugins.jacoco) in method public void ensureValid(), e.g.: # maxClass was parsed as 0 (not set) and applyRange returns 0 ; # minClass was set to 10 and applyRange is called with params 0, 10, 0 and return 0 . See: [https://github.com/jenkinsci/jacoco-plugin/blob/master/src/main/java/hudson/plugins/jacoco/JacocoHealthReportThresholds.java#L49-L59] |