Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI build reports success on failed tests #251

Closed
arm4b opened this issue Oct 5, 2022 · 8 comments · Fixed by #252
Closed

CI build reports success on failed tests #251

arm4b opened this issue Oct 5, 2022 · 8 comments · Fixed by #252

Comments

@arm4b
Copy link
Member

arm4b commented Oct 5, 2022

See https://github.com/StackStorm/st2-docker/actions/runs/3189178778/jobs/5202693378#step:5:20
where the BATS tests failed, but for some reason, the non-zero exit code is lost somewhere in between.

Screenshot 2022-10-05 at 11-51-28 Merge pull request #250 from mamercad_github · StackStorm_st2-docker@9609a00

This is a bug and help wanted to fix it.

@mamercad
Copy link
Contributor

mamercad commented Oct 5, 2022

This is ... interesting (added echo $?) right afterwards:

<snip>
sleep 60
docker-compose -f tests/st2tests.yaml up
echo $?

@mamercad
Copy link
Contributor

mamercad commented Oct 5, 2022

So, I think what's happening is that we need to somehow push the exit code from the bats stuff outwards to docker-compose (the caller).

@arm4b
Copy link
Member Author

arm4b commented Oct 5, 2022

So sounds like docker-compose up job is to start the containers which it does successfully, and it doesn't care about the exit codes.

@mamercad
Copy link
Contributor

mamercad commented Oct 5, 2022

Yeah ... fiddling with --abort-on-container-exit --exit-code-from st2test-tools ...

@mamercad
Copy link
Contributor

mamercad commented Oct 5, 2022

Also, I noticed I missed making the jobs dependent:

  docker-compose-up:
    runs-on: ubuntu-latest
    needs: [docker-compose-lint]

The "needs" directive, i.e., if linting fails, don't bother doing what's next.

@arm4b
Copy link
Member Author

arm4b commented Oct 5, 2022

--exit-code-from
Good find!

@mamercad
Copy link
Contributor

mamercad commented Oct 5, 2022

--exit-code-from Good find!

Hehe, I'm not sure I'm fond of docker-compose to be honest:

Aborting on container exit...
0

Presumably that's from --abort-on-container-exit; trying just --exit-code-from st2test-tools.

@mamercad
Copy link
Contributor

mamercad commented Oct 5, 2022

This is quite painful:

st2test_1        | ln: failed to create symbolic link '/sbin/bats': File exists
tests_st2test-tools_1 exited with code 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants