mirror of https://github.com/ansible/ansible.git
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.pull/36810/head
parent
5b5a79917d
commit
ac1698099d
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"always": true,
|
||||||
|
"output": "path-message"
|
||||||
|
}
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"always": true,
|
||||||
|
"output": "path-message"
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
# required by external automated processes and should not be moved, renamed or converted to a symbolic link
|
||||||
|
path = 'examples/scripts/ConfigureRemotingForAnsible.ps1'
|
||||||
|
directory = path
|
||||||
|
|
||||||
|
while True:
|
||||||
|
directory = os.path.dirname(directory)
|
||||||
|
|
||||||
|
if not directory:
|
||||||
|
break
|
||||||
|
|
||||||
|
if not os.path.isdir(directory):
|
||||||
|
print('%s: must be a directory' % directory)
|
||||||
|
|
||||||
|
if os.path.islink(directory):
|
||||||
|
print('%s: cannot be a symbolic link' % directory)
|
||||||
|
|
||||||
|
if not os.path.isfile(path):
|
||||||
|
print('%s: must be a file' % path)
|
||||||
|
|
||||||
|
if os.path.islink(path):
|
||||||
|
print('%s: cannot be a symbolic link' % path)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@ -1,9 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
FILE='examples/scripts/ConfigureRemotingForAnsible.ps1'
|
|
||||||
|
|
||||||
if [ ! -f "${FILE}" ] || [ -h "${FILE}" ]; then
|
|
||||||
echo 'The file "ConfigureRemotingForAnsible.ps1" is missing or is not a regular file.'
|
|
||||||
echo 'It is required by external automated processes and should not be moved or renamed.'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"always": true,
|
||||||
|
"output": "path-message"
|
||||||
|
}
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"always": true,
|
||||||
|
"output": "path-message"
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"prefixes": [
|
||||||
|
"test/runner/requirements/"
|
||||||
|
],
|
||||||
|
"extensions": [
|
||||||
|
".txt"
|
||||||
|
],
|
||||||
|
"output": "path-line-column-message"
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
skip = set([
|
||||||
|
'test/runner/requirements/constraints.txt',
|
||||||
|
'test/runner/requirements/integration.cloud.azure.txt',
|
||||||
|
])
|
||||||
|
|
||||||
|
for path in sys.argv[1:] or sys.stdin.read().splitlines():
|
||||||
|
if path in skip:
|
||||||
|
continue
|
||||||
|
|
||||||
|
with open(path, 'r') as path_fd:
|
||||||
|
for line, text in enumerate(path_fd.readlines()):
|
||||||
|
match = re.search(r'^[^;#]*?([<>=])(?!.*sanity_ok.*)', text)
|
||||||
|
|
||||||
|
if match:
|
||||||
|
print('%s:%d:%d: put constraints in `test/runner/requirements/constraints.txt`' % (
|
||||||
|
path, line + 1, match.start(1) + 1))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@ -1,17 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
constraints=$(
|
|
||||||
grep '.' test/runner/requirements/*.txt \
|
|
||||||
| grep -v '(sanity_ok)$' \
|
|
||||||
| sed 's/ *;.*$//; s/ #.*$//' \
|
|
||||||
| grep -v '/constraints.txt:' \
|
|
||||||
| grep -v '/integration.cloud.azure.txt:' \
|
|
||||||
| grep '[<>=]'
|
|
||||||
)
|
|
||||||
|
|
||||||
if [ "${constraints}" ]; then
|
|
||||||
echo 'Constraints for test requirements should be in "test/runner/requirements/constraints.txt".'
|
|
||||||
echo 'The following constraints were found outside the "constraints.txt" file:'
|
|
||||||
echo "${constraints}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
Loading…
Reference in New Issue