diff options
Diffstat (limited to '')
-rwxr-xr-x | debian/tests/unit-tests-stable | 60 | ||||
-rwxr-xr-x | debian/tests/unit-tests-stable.py | 63 |
2 files changed, 63 insertions, 60 deletions
diff --git a/debian/tests/unit-tests-stable b/debian/tests/unit-tests-stable deleted file mode 100755 index d8e4a5b7f..000000000 --- a/debian/tests/unit-tests-stable +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh - -set -e - -BASEPATH=$(pwd) - -unit_test_dirs=" -ansible_collections/amazon/aws -ansible_collections/ansible/posix -ansible_collections/ansible/windows -ansible_collections/arista/eos -ansible_collections/cisco/aci -ansible_collections/cisco/asa -ansible_collections/cisco/ios -ansible_collections/cisco/iosxr -ansible_collections/cisco/nso -ansible_collections/cisco/nxos -ansible_collections/community/crypto -ansible_collections/community/docker -ansible_collections/community/fortios -ansible_collections/community/google -ansible_collections/community/grafana -ansible_collections/community/kubevirt -ansible_collections/community/libvirt -ansible_collections/community/mysql -ansible_collections/community/network -ansible_collections/community/postgresql -ansible_collections/community/rabbitmq -ansible_collections/community/routeros -ansible_collections/community/windows -ansible_collections/f5networks/f5_modules -ansible_collections/frr/frr -ansible_collections/google/cloud -ansible_collections/mellanox/onyx -ansible_collections/netapp/aws -ansible_collections/netapp/elementsw -ansible_collections/netbox/netbox -ansible_collections/openvswitch/openvswitch -ansible_collections/vyos/vyos -" - -for i in $unit_test_dirs; do - - cd $i 2> /dev/null || continue - - echo "\n\n" - echo "############################################################" - echo "############################################################" - echo "#### Running tests in $i" - echo "############################################################" - echo "############################################################" - - /usr/bin/ansible-test units \ - --python-interpreter /usr/bin/python3 \ - --local - - cd $BASEPATH -done - -exit 0 diff --git a/debian/tests/unit-tests-stable.py b/debian/tests/unit-tests-stable.py new file mode 100755 index 000000000..f44044991 --- /dev/null +++ b/debian/tests/unit-tests-stable.py @@ -0,0 +1,63 @@ +#!/usr/bin/python3 + +import glob +import os +import subprocess +import sys + +sys.dont_write_bytecode = True +from flaky_tests_list import flaky_test_dirs + +cwd = os.getcwd() + +overall_test_rc = 0 +failed_tests = [] + +# find all dirs that have unit tests +for i in glob.glob('ansible_collections/**/tests/unit', recursive=True): + + # base path to run ansible-test is two levels up + testdir = os.path.normpath( + os.path.join(i, '..', '..') + ) + + # skip any tests that are flagged as flaky + if testdir in flaky_test_dirs: + print("Skipping", testdir) + continue + + os.chdir(testdir) + + print ("\n\n", flush=True) + print ("############################################################", flush=True) + print ("############################################################", flush=True) + print ("#### Running tests in", testdir, flush=True) + print ("############################################################", flush=True) + print ("############################################################", flush=True) + + rc = subprocess.run([ + '/usr/bin/ansible-test', + 'units', + '--python-interpreter', + '/usr/bin/python3', + '--local' + ]) + + + if rc.returncode != 0: + failed_tests.append(i) + overall_test_rc = rc.returncode + + os.chdir(cwd) + + +if overall_test_rc != 0: + print ("############################################################", flush=True) + print ("############################################################", flush=True) + print ("#### failed tests are:", flush=True) + for i in failed_tests: + print ("####", i, flush=True) + print ("############################################################", flush=True) + print ("############################################################", flush=True) + +exit(overall_test_rc) |