1

I am using pipline to build and run unit tests.

Here is my pipeline:

pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                sh '''
                  ./system/fuge/ci/docker-up.sh
                  ./system/fuge/ci/docker-down.sh
                '''
            }
        }

        stage('Test') {
            steps {
                sh '''
                 ./system/fuge/ci/docker-up-test.sh
               '''
            }
        }
}
        post {
        always {
            junit 'build/reports/**/*.xml'
          }
        }

}

And I get thiss error:

[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] junit
Recording test results
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: No test report files were found. Configuration error?
Finished: FAILURE

Anyone know what is a problem?

I also use node.js, lab.js for testing

Vladimir Djukic
  • 925
  • 2
  • 9
  • 28
  • when you run `./system/fuge/ci/docker-up-test.sh` outside of jenkins, do some xml files show up in `build/reports/**/*.xml`? – burnettk Aug 20 '17 at 00:50
  • looks like your archive the wrong folder , make sure you have some xml on the specific path. you can check the machine that run the pipeline after it complete and find the xml's , than you can fixed the archived command. – Mor Lajb Aug 20 '17 at 09:40
  • The tests reports are in my docker containers how can I access them? – Vladimir Djukic Aug 20 '17 at 12:21

1 Answers1

0

If you are running your tests in a docker container, you can get them back out to the host by either bind-mounting the directory out to the host (with docker-compose volumes. be aware this may result in strange permissions for files on the host) or by running docker cp after the tests have completed inside the container, like this:

# make sure the directory exists on the host
mkdir -p build/reports

# make sure the directory we want to copy doesn't exist on the host
rm -rf build/reports/something

# copy directory from container to host
docker cp CONTAINER_NAME:build/reports/something build/reports/something
burnettk
  • 13,557
  • 4
  • 51
  • 52
  • can you please try with one of the two above strategies (that both work with docker-compose and jenkins) and then report back here if you can't manage to get it to work after a few hours? – burnettk Aug 20 '17 at 13:55
  • C/P works but how can I dinamicly get container name, also how can I c/p all tests from folder not just one? – Vladimir Djukic Aug 20 '17 at 14:01
  • check to see what the container name is when the tests run. it's generally pretty conventional (fuge_api_1 or something). unfortunately docker-compose doesn't let you specify a container name, since that would be pretty handy for the CI use case. i updated the answer to show how to copy a whole directory instead of a file. – burnettk Aug 20 '17 at 14:07
  • Okay, when I C/P files now it works but I get error from Jenkins:`ERROR: Test reports were found but none of them are new. Did tests run? For example, ,,,seneca/test/api.xml is 27 sec old` – Vladimir Djukic Aug 20 '17 at 14:16
  • please accept this if it answered your original question. :) – burnettk Aug 20 '17 at 19:20