mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 13:50:22 -07:00
Remove legacy test alias migration script. (#19629)
* Require code-smell tests to be files. * Add sanity check for integration test aliases. * Remove migration script for test aliases.
This commit is contained in:
parent
241ad8cac3
commit
422857166b
4 changed files with 81 additions and 142 deletions
77
test/sanity/code-smell/integration-aliases.py
Executable file
77
test/sanity/code-smell/integration-aliases.py
Executable file
|
@ -0,0 +1,77 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import textwrap
|
||||
|
||||
|
||||
def main():
|
||||
targets_dir = 'test/integration/targets'
|
||||
|
||||
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')
|
||||
files = sorted(os.listdir(target_dir))
|
||||
|
||||
# aliases already defined
|
||||
if os.path.exists(aliases_path):
|
||||
continue
|
||||
|
||||
# don't require aliases for support directories
|
||||
if any(os.path.splitext(f)[0] == 'test' for f in files):
|
||||
continue
|
||||
|
||||
# don't require aliases for setup_ directories
|
||||
if target.startswith('setup_'):
|
||||
continue
|
||||
|
||||
# don't require aliases for prepare_ directories
|
||||
if target.startswith('prepare_'):
|
||||
continue
|
||||
|
||||
# TODO: remove this exclusion once the `ansible-test network-integration` command is working properly
|
||||
# don't require aliases for network modules
|
||||
if any(target.startswith('%s_' % prefix) for prefix in network_prefixes):
|
||||
continue
|
||||
|
||||
missing_aliases.append(target_dir)
|
||||
|
||||
if missing_aliases:
|
||||
message = '''
|
||||
The following integration target directories are missing `aliases` files:
|
||||
|
||||
%s
|
||||
|
||||
Unless a test cannot run as part of CI, you'll want 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.
|
||||
|
||||
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.
|
||||
''' % '\n'.join(missing_aliases)
|
||||
|
||||
print(textwrap.dedent(message).strip())
|
||||
|
||||
exit(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue