Bitbucket Pipelines fail upon successfull execution of unit tests
Asked by Angelos Naoum:

We have configured a pipeline where we ran some unit tests for a PHP Laravel project which includes the below:  

```
- step:
name: Unit tests
services:
- mysql
image: webdevops/php-nginx:8.2
script:
- composer install --no-interaction --optimize-autoloader --ignore-platform-reqs
- pecl install xdebug
- echo "extension=xdebug.so" >> /opt/docker/etc/php/php.ini && echo "zend_extension = xdebug" >> /opt/docker/etc/php/php.ini && echo "xdebug.mode=coverage" >> /opt/docker/etc/php/php.ini
- php artisan test --coverage-clover tests/reports/coverage/coverage.xml --configuration phpunit.xml
artifacts:
- tests/reports/coverage/**
```

The unit tests are running successfully, so the pipeline should continue to the next step alhtough upon the successfull execution of the tests, the pipeline fails with no any explanation or any insightful log.  

The same setup was working until few days ago.  
We also tried to manually re-run a previous successful pipeline and the issue occurrs there too.  
![test.png](/t5/image/serverpage/image-id/309964i8E0F2FDC7824CDEF/image-size/large?v=v2&px=999 "test.png")


Answers:
author: Patrik S
body: Hello [@Angelos Naoum](/t5/user/viewprofilepage/user-id/5272190) ,

thank you for reaching out to the Community!

The way that pipelines identify if a step was successful or not is based on the exit code of the commands being executed. A command that exits with code zero indicates a successful step, while any exit code other than zero will make the step be considered as failed. What may be the case is the command you are executing is returning a non-zero exit code even when the tests are successful, making the pipeline understand it as a failure.

That being said, I see you have also opened a support ticket with us to report this issue, and one of my colleagues is already investigating the affected build. In this case, I would suggest focusing the discussion on the support ticket to avoid any confusion that may arise from discussing the same issue in multiple places.

If you feel comfortable, once the support ticket is resolved, feel free to share the solution here in the Community so other users facing similar issues can try the same solution :)

Thank you, [@Angelos Naoum](/t5/user/viewprofilepage/user-id/5272190) !

Patrik S


author: Jessey van Offeren
body: Running into the same issue here, finally able to run our tests in bitbuckets pipeline with the newly increased size, and now it turns out to always failing the step even when successful.

comments: author: Patrik S
body: Hello [@Jessey van Offeren](/t5/user/viewprofilepage/user-id/5529390) ,

I would like to ask if you could please create a new question for your issue, providing details on the errors and your setup.

We generally encourage users to create a new question for their issue instead of posting on someone else's question, because

1) the root cause and resolution may be different for each case

2) a question can become cluttered and difficult to follow if we try to troubleshoot multiple users' issues in it.

Please feel free to let me know if you have any questions.

Thank you!


Tags: bitbucket-cloud

cloud