Fix test coverage report job

Over in !4682 (merged) we changed this job because it was failing in CC MRs. Specifically, in CCMRs the windows 21H2 unit tests jobs do not run:

windows 21H2 unit tests:
extends:
- .windows unit test
- .windows21H2
- .rules:merge_request_pipelines:no_docs:no-community-mr

But the coverage report job wants to run some tests on the artifact produced by those jobs. The code to conditionally handle that was originally

test -n $(find .splitic -name 'junit_servercore21H2_*.xml' -maxdepth 1 -print -quit) && splitic junit-check -quarantined ci/.test-failures.servercore21H2.txt .splitic/junit-check -quarantined ci/.test-failures.servercore21H2.txt .splitic/junit_servercore21H2_*.xml

However, if the files junit_servercore21H2_*.xml did not exist, test -n would exit with a non-zero exit code, and cause the job to fail. I suggested adding

|| echo "Skipping servercore 21H2 unit test coverage report"

To the end of command expression, but this was wrong because it would make the command pass ALWAYS (even if the junit-check failed).

What we want is for the test to exit with a zero exit code if the file does not exists, and run the junit-check command otherwise. test -z does this by checking if the specified string is zero, which happens when the junit_servercore21H2_ files do not exists.

Edited by Axel von Bertoldi

Merge request reports

Loading