`run_buildbox_unit_test()`: fix exit condition
Before raising this MR, consider whether the following are required, and complete if so:
[ ] Unit tests[ ] Metrics[ ] Documentation update(s)
If not required, please explain in brief why not.
Description
buildbox-run-userchroot!53 (merged) uncovered an issue with the step that runs the unit tests in bin/end-to-end-test.sh
.
In particular, buildbox-common!391 changed slightly the behavior of a method and caused one of buildbox-run-userchroot
's unit tests that checks for an edge case to start failing.
The unit test was executed by buildbox-e2e on the CI for that MR and it failed as expected, but the script did not exit at that point, reporting a successful status to the CI.
1: [ RUN ] UserChrootRunnerValidateChrootFixture.TestErrorReturnsEmptyDigest
1: unknown file: Failure
1: C++ exception with description "vector::_M_range_check: __n (which is 0) >= this->size() (which is 0)" thrown in the test body.
1: [ FAILED ] UserChrootRunnerValidateChrootFixture.TestErrorReturnsEmptyDigest (3 ms)
Changes proposed in this merge request:
- Refactor commands in
run_buildbox_unit_test()
to properlyexit 1
if one or more unit tests return non-zero
Validation
To test this, pull the image generated for this MR,
docker pull registry.gitlab.com/buildgrid/buildbox/buildbox-e2e:santigl-fix-unit-test-exit-status
and execute end-to-end-test.sh
with the unit tests enabled.
docker run -e BUILDBOX_RUN_UNIT_TESTS=1 -ti registry.gitlab.com/buildgrid/buildbox/buildbox-e2e:santigl-fix-unit-test-exit-status end-to-end-test.sh
Before buildbox-common!396 is merged (fixes the failing buildbox-run-userchroot unit test), end-to-end-test.sh
should exit 1
right after the step that runs the unit tests.
...
23: [ OK ] EnvTest.EnvFromFile (1 ms)
23: [----------] 1 test from EnvTest (1 ms total)
23:
23: [----------] Global test environment tear-down
23: [==========] 1 test from 1 test case ran. (1 ms total)
23: [ PASSED ] 1 test.
23/23 Test #23: env_from_file_test ................ Passed 0.13 sec
100% tests passed, 0 tests failed out of 23
Total Test time (real) = 3.90 sec
ERROR: Some unit test failed.