Skip to content

Fix race condition in test.sh

Adam Cohen requested to merge fix-race-condition into master

While working on Support overriding java version using asdf, I came across a failure in the test-custom-ca job:

 $ run_test() { # collapsed multi-line command
 $ if [ "$RUN_CMD" -eq 1 ]; then run_test run; else echo skipping run; fi
 2020/06/05 11:52:00 Get https://ssl-test/: x509: certificate signed by unknown authority

When I ran test.sh locally, the same failure occurred, however, when I ran the commands individually, the test passed. It turns out this is caused by a race condition because the ssl-test check relies on the /analyzer command writing the cacert file to disk. If the ssl-test command is run before the /analyzer has a chance to finish writing the file to disk, then the ssl-test check will fail.

Edited by Adam Cohen

Merge request reports

Loading