Hi all,
I have a dotnet core app i am trying to run tests against, to discover my tests i am running the find command in bash. When doing this if the tests fail, the build still passes. Does anyone have any ideas on how to get it failing or any workarounds
Thanks
Jordan
fail_erm_wut.PNG
I Solved the issue. if anyone else is having the same issue you can use or do do something similar to this
bitbucket-pipelines.yml
image: microsoft/dotnet:onbuild pipelines: default: - step: script: # Modify the commands below to build your repository. - dotnet restore - dotnet build *\\**\\project.json - chmod u+x Build.sh - ./Build.sh
then create a build script containing
Build.sh
#!/bin/bash TESTS=`find "tests" -name 'project.json'` for FILE in $TESTS; do COMMAND="dotnet test $FILE" $COMMAND done
this will find any project that contains the word tests and runs dotnet test against the project. if the tests fail the build will fail, if the tests pass the build will pass. its pretty dumb search atm but works for me. tweak to your needs
Nice job!
I'm just going to add some additional information for anyone looking into a similar problem: Pipelines determines the status of your build by reading the exit code of your bash commands. The find command here had wrapped the execution of the dotnet tests, but didn't seem to be propagating the exit code from the tests. Instead it was returning that it successfully completed the "find". The solution here (and in other similar problems) will be to try and find a way to ensure that Pipelines can see the exit codes of your commands.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.