mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 21:30:22 -07:00
Overhaul additional sanity tests. (#36803)
* Remove unnecessary sys.exit calls. * Add files filtering for code-smell tests. * Enhance test-constraints code-smell test. * Simplify compile sanity test. * Pass paths to importer on stdin. * Pass paths to yamllinter on stdin. * Add work-around for unicode path filtering. * Enhance configure-remoting-ps1 code-smell test. * Enhance integration-aliases code-smell test. * Enhance azure-requirements code-smell test. * Enhance no-illegal-filenames code-smell test.
This commit is contained in:
parent
5b5a79917d
commit
ac1698099d
23 changed files with 153 additions and 208 deletions
|
@ -10,8 +10,6 @@ def main():
|
|||
with open('test/integration/target-prefixes.network', 'r') as prefixes_fd:
|
||||
network_prefixes = prefixes_fd.read().splitlines()
|
||||
|
||||
missing_aliases = []
|
||||
|
||||
for target in sorted(os.listdir(targets_dir)):
|
||||
target_dir = os.path.join(targets_dir, target)
|
||||
aliases_path = os.path.join(target_dir, 'aliases')
|
||||
|
@ -38,47 +36,7 @@ def main():
|
|||
if any(target.startswith('%s_' % prefix) for prefix in network_prefixes):
|
||||
continue
|
||||
|
||||
missing_aliases.append(target_dir)
|
||||
|
||||
if missing_aliases:
|
||||
message = textwrap.dedent('''
|
||||
The following integration target directories are missing `aliases` files:
|
||||
|
||||
%s
|
||||
|
||||
If these tests cannot be run as part of CI (requires external services, unsupported dependencies, etc.),
|
||||
then they most likely belong in `test/integration/roles/` instead of `test/integration/targets/`.
|
||||
In that case, do not add an `aliases` file. Instead, just relocate the tests.
|
||||
|
||||
However, if you think that the tests should be able to be supported by CI, please discuss test
|
||||
organization with @mattclay or @gundalow on GitHub or #ansible-devel on IRC.
|
||||
|
||||
If these tests can be run as part of CI, you'll need to add an appropriate CI alias, such as:
|
||||
|
||||
posix/ci/group1
|
||||
windows/ci/group2
|
||||
|
||||
The CI groups are used to balance tests across multiple jobs to minimize test run time.
|
||||
Using the relevant `group1` entry is fine in most cases. Groups can be changed later to redistribute tests.
|
||||
|
||||
Aliases can also be used to express test requirements:
|
||||
|
||||
needs/privileged
|
||||
needs/root
|
||||
needs/ssh
|
||||
|
||||
Other aliases are used to skip tests under certain conditions:
|
||||
|
||||
skip/freebsd
|
||||
skip/osx
|
||||
skip/python3
|
||||
|
||||
Take a look at existing `aliases` files to see what aliases are available and how they're used.
|
||||
''').strip() % '\n'.join(missing_aliases)
|
||||
|
||||
print(message)
|
||||
|
||||
exit(1)
|
||||
print('%s: missing integration test `aliases` file' % aliases_path)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue