Re: [go-cd] Fail job if test fails?

336 views
Skip to first unread message
Message has been deleted

Zabil C M

unread,
Feb 13, 2015, 1:23:45 AM2/13/15
to nji...@oanda.com, go...@googlegroups.com
Hi,
 A few questions!

 What test runner do you use? 
 Is there a reason why the test runner is not failing the tests?
 If you are using a script to run these try returning the right exit code to fail the job.


On Fri, Feb 13, 2015 at 9:24 AM, <nji...@oanda.com> wrote:
I'm running test remotely on a system, and when I collect the test results in xml using the test artifacts collection method, is there a way to fail the job if there are errors in the result? 

The result tab for my job would look something like this

Failed tests

Tests run: 157 , Failures: 1 , Not run: 0 , Time: 15.387 seconds.

Failure test1
Unit Test Failure and Error Details (1)
...


Thanks!

--
You received this message because you are subscribed to the Google Groups "go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go-cd+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

nji...@oanda.com

unread,
Feb 13, 2015, 10:53:53 AM2/13/15
to go...@googlegroups.com, nji...@oanda.com
I accidentally deleted my original, sorry about that. 

Aravind SV

unread,
Feb 23, 2015, 8:43:11 AM2/23/15
to nji...@oanda.com, go...@googlegroups.com
 On Fri, Feb 13, 2015 at 9:24 AM, <nji...@oanda.com> wrote:
I'm running test remotely on a system, and when I collect the test results in xml using the test artifacts collection method, is there a way to fail the job if there are errors in the result? 

As Zabil said, the test runner needs to fail with a non-zero exit code. Go will not fail the job based on errors in the report (this is because the report is generated on the server side, and the agent decides whether a job fails).

If you are running your tests remotely, then the remote script is probably not exiting with the right exit status, or the exit status is getting lost when it comes back to the agent. For instance, using ssh, it does exit properly, as you can see below.

Inline image 1

You'll need to find the exit code of your remote run, and see why it is 0, instead of non-zero. That depends on how you run your remote task.

Cheers,
Aravind
 
Reply all
Reply to author
Forward
0 new messages