mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 10:25:28 +00:00
Automation Hub, and possibly Galaxy in the future, require the collection to be screened with `ansible-test sanity` among other checks. The role had a number of issues: * Use `AssertionError` instead of `assert` * Use of `logging` module not in accordance with standards, but these are ok and the errors were suppressed * Several import errors which are ok because they are checked elsewhere * __init__.py in the module_utils directories must be empty, so a new file myerror.py was added to move the code from __init__.py * NOTE: network_lsr/nm/__init__.py is not empty * The documentation block in the module was not properly constructed or formatted. * shellcheck issues, including removing unused files * use `unused` instead of `_` (underscore) for variables that are unused add WARNING to module docs - collection users should not use directly Signed-off-by: Rich Megginson <rmeggins@redhat.com>
34 lines
929 B
Bash
Executable file
34 lines
929 B
Bash
Executable file
#!/bin/bash
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
set -e
|
|
coverage_data=total-coveragedata
|
|
testhost="${1}"
|
|
|
|
if [ "$#" -lt 1 ]
|
|
then
|
|
echo "USAGE: ${0} host"
|
|
echo "Get local and all remote coverage data for host"
|
|
exit 1
|
|
fi
|
|
|
|
rm -f remote-coveragedata* "${coverage_data}"
|
|
|
|
|
|
# collect pytest coverage
|
|
tox -e py26,py27,py36,py37 -- --cov-append
|
|
|
|
for test_playbook in tests_*.yml
|
|
do
|
|
./get_coverage.sh "${testhost}" "${test_playbook}"
|
|
done
|
|
|
|
./merge_coverage.sh coverage "total-remote-coveragedata" remote-coveragedata-*
|
|
./covstats .coverage remote-coveragedata-* "total-remote-coveragedata"
|
|
|
|
./merge_coverage.sh coverage "${coverage_data}" .coverage remote-coveragedata-*
|
|
echo "Total coverage:"
|
|
COVERAGE_FILE="${coverage_data}" coverage report ||:
|
|
COVERAGE_FILE="${coverage_data}" coverage html --directory "htmlcov-${coverage_data}" ||:
|
|
echo "Open HTML report with:"
|
|
echo "xdg-open htmlcov-${coverage_data}/index.html"
|