Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-39696

Trend counts only first reports in Pipeline Job with parallel nodes

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Duplicate
    • Component/s: junit-plugin, pipeline
    • Labels:
      None
    • Environment:
      Jenkins 2.19.2, JUnit 1.19
    • Similar Issues:

      Description

      I have a Pipeline Job with parallel test executions, where every node executor submits own junit reports (obviously, because they are in different workspaces, it's hard to collect reports to one place).

      First of all, it takes some time (up to 5 minutes) even after job is finished to collect/reflect reports on job's test reports page (:job_name/:build_number/testReport/). Rarely, it doesn't track report from some parallel job.

      And it shows wrong (less) tests number on job's test result trend chart. Every build it shows different random number, however they are builds for the same revision.

      My suggestion, is that Trend Test Result chart get's generated before all test results are collected.
      Probably it's a consequence of asynchronous job test result collection, where it collects all reports even after job is finished.

      My approximate workflow is:

        node {
          stage('Preparation') {
            checkout scm
            stash 'workspace'
          }
        }
        stage('Run Tests') {
          def splits = splitTests parallelism: count(workersCount), generateInclusions: true
          def testGroups = [:]
      
          for (int i = 0; i < splits.size(); i++) {
            def index = i;
            def split = splits[index]
            node {
              //may be different workspace, so unstash
              unstash 'workspace'
              try { 
                sh 'run_tests_here.sh'
              } finally {
                junit 'log/reports/*.xml'
                // clean reports, because next thread may be executed in the same workspace
                sh 'rm -f log/reports/*' 
              }
            }
          } 
        }
      

      P.S. Probably my approach is wrong and I'd love to hear any suggestions.
      My job can run in parallel within the same workspace, but `node` step dedicates new workspace automatically + nodes may be on different machines, so gathering test reports afterward is even harder.

        Attachments

          Issue Links

            Activity

            Hide
            kukunin Sergiy Kukunin added a comment -
            • A couple jobs of the same revision (code and tests are equal for all jobs)
            Show
            kukunin Sergiy Kukunin added a comment - A couple jobs of the same revision (code and tests are equal for all jobs)
            Hide
            teilo James Nord added a comment -

            could possibly be a dupe of JENKINS-41134

            Show
            teilo James Nord added a comment - could possibly be a dupe of JENKINS-41134
            Hide
            jglick Jesse Glick added a comment -

            Probably.

            Show
            jglick Jesse Glick added a comment - Probably.

              People

              • Assignee:
                Unassigned
                Reporter:
                kukunin Sergiy Kukunin
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: