[tests-only] Lint expected-failures files #39782
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.
Description
It is easy to get errors in an expected-failures file, specially with the link to the line number of the file in GitHub:
If there is any typo in the link, that is the
(https://github.com/...)
string then it does not get really noticed, but ends up being an invalid link and is annoying for humans who click on it, or humans who wonder why the link points to somewhere different.The common errors are that the suite and/or feature file name is wrong (a cut-paste error from another entry...), or that the line number is wrong (the
:27
got updated but the old#L26
gets forgotten when line numbers change).This PR adds the script
lint-expected-failures.sh
. The existing checks of the expected-failures file have been moved there, and additional checks added to make sure that the link to GitHub is the correct link that matches the suite/feature/line number in[apiWebdavMove1/moveFolder.feature:27]
The referenced repo where the feature files live is usually
owncloud/core
so that is the default for the check. But sometimes the feature files are in somewhere likeowncloud/ocis
and the corerun.sh
script and the core test code is being run but to execute "local" feature files in oCIS (or maybe even reva, or whatever. In the general case, the corerun.sh
andlint-expected-failures.sh
does not know where the feature files are that are about to be executed. (Maybe the script could somehow try really hard to deduce it, but it is not simple) Sometimes tests are executed from release QA tarballs and so the test scripts and test feature files are not in a local clone of the various git repos involved, so we can't rely on grabbing a git "repo slug" to help us guess.If the linter sees a sentence like:
The expected failures in this file are from features in the owncloud/ocis repo.
then it learns that the expected-failures file is supposed to be for feature files that are stored in
owncloud/ocis
and checks that the links do go to that GitHub repo.How Has This Been Tested?
CI - see owncloud/ocis#3147
I purposely put errors in an expected-failures file and the linter reported them and failed the pipelines where they were used.
I added the line
The expected failures in this file are from features in the owncloud/ocis repo.
to the expected-failures file for localAPI tests, and they get linted correctly.Having this linter code in a separate bash script means we can call it locally/manually to check an expected-failures fail if we want. In future we could add a Makefile target to repos that would help people lint-check expected-failures files before pushing to GitHub.
Types of changes
Checklist: