[JIRA] (JENKINS-58184) Jacoco delta threshold failures if coverage *increases* over threshold

7 views
Skip to first unread message

raino.kolk@gmail.com (JIRA)

unread,
Jun 25, 2019, 7:00:03 AM6/25/19
to jenkinsc...@googlegroups.com
Raino Kolk created an issue
 
Jenkins / Bug JENKINS-58184
Jacoco delta threshold failures if coverage *increases* over threshold
Issue Type: Bug Bug
Assignee: Ognjen Bubalo
Components: jacoco-plugin
Created: 2019-06-25 10:59
Priority: Minor Minor
Reporter: Raino Kolk

Jacoco delta threshold got failure if some coverage metrics decreases less than delta threshold but some increases over delta threshold.

Problematic code is 

JacocoPublisher.java

public Result checkBuildOverBuildResult(Run<?,?> run, PrintStream logger){

        JacocoDeltaCoverageResultSummary deltaCoverageResultSummary = JacocoDeltaCoverageResultSummary.build(run);
        logger.println("[JaCoCo plugin] Delta coverage: class: " + deltaCoverageResultSummary.getClassCoverage()
                + ", method: " + deltaCoverageResultSummary.getMethodCoverage()
                + ", line: " + deltaCoverageResultSummary.getLineCoverage()
                + ", branch: " + deltaCoverageResultSummary.getBranchCoverage()
                + ", instruction: " + deltaCoverageResultSummary.getInstructionCoverage()
                + ", complexity: " + deltaCoverageResultSummary.getComplexityCoverage());

        if(Math.abs(deltaCoverageResultSummary.getInstructionCoverage()) <= deltaHealthReport.getDeltaInstruction() &&
                Math.abs(deltaCoverageResultSummary.getBranchCoverage()) <= deltaHealthReport.getDeltaBranch() &&
                Math.abs(deltaCoverageResultSummary.getComplexityCoverage()) <= deltaHealthReport.getDeltaComplexity() &&
                Math.abs(deltaCoverageResultSummary.getLineCoverage()) <= deltaHealthReport.getDeltaLine() &&
                Math.abs(deltaCoverageResultSummary.getMethodCoverage()) <= deltaHealthReport.getDeltaMethod() &&
                Math.abs(deltaCoverageResultSummary.getClassCoverage()) <= deltaHealthReport.getDeltaClass())
            return Result.SUCCESS;
        else if(deltaCoverageResultSummary.isCoverageBetterThanPrevious())
            return Result.SUCCESS;
        else
            return Result.FAILURE;
    }

 The above code uses abs. This means that check not make any difference of increase or decrease. If not all metrics are increased then isCoverageBetterThanPrevious gives false. so Despite all decreases are below delta threshold  build fails if some of increase more than delta. This is not logical because coverage increase should not be measured against delta at all.

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

raino.kolk@gmail.com (JIRA)

unread,
Jun 25, 2019, 7:28:02 AM6/25/19
to jenkinsc...@googlegroups.com
Raino Kolk commented on Bug JENKINS-58184
 
Re: Jacoco delta threshold failures if coverage *increases* over threshold

Why not check before abs that coverage delta is negative? It should be ok to ignore positive delta from that check.

dominik.stadler@gmx.at (JIRA)

unread,
Sep 22, 2019, 6:12:02 PM9/22/19
to jenkinsc...@googlegroups.com
centic commented on Bug JENKINS-58184

this was contributed, so I am not sure what the original intent was on these checks, however I also would not expect a failure when coverage actually increases. Can you provide a PR which simplifies/improves this handling?

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages