treat IOException in index check as success #4402
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As suggested in #4401 (reply in thread), the index check should treat
IOException
separately. If such error happens, the indexer exits with return code of 2. The exit code of 1 is restricted to legitimate index check errors. The Docker startup script will wipe out the index (withCHECK_INDEX
set) only if indexer program returns 1.This also changes how the checks are done by the indexer. Previously, the index checks were cumulative, such that when duplicate document check was specified, the indexer also performed version check. This is no longer true, the check modes are now exclusive.
Also, new check for definitions was added, however at this stage this is experimental as there are variances and nuances how definitions are generated for various files. The check takes the definitions as produced by ctags and loosely checks if they are present in the corresponding source file.
For the test of
IOException
being throw, I tried using static method mocking (had to update to Mockito v5 first), however had no luck with that, so the test is based onIOException
being thrown for non-existent directory. Should probably bite the bullet and convert theIndexCheck
class to non-static/utility so that normal mocking can be done.