From 82b5a6a0c9ea680a024eddd3f3039dd8fc10da3e Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Tue, 9 Jan 2018 14:52:36 -0800 Subject: [PATCH] Fix ansible-test network-integration command. (#34661) * Fix ansible-test network platform init filter. * Fix ansible-test network inventory generation. * Remove ios/csr1000v from CI. * Run network tests on Python 2.7 and 3.6. --- test/runner/lib/executor.py | 11 ++++++++++- test/utils/shippable/network.sh | 3 --- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/test/runner/lib/executor.py b/test/runner/lib/executor.py index 2d0049d8a3d..3ccd7c58eae 100644 --- a/test/runner/lib/executor.py +++ b/test/runner/lib/executor.py @@ -373,6 +373,7 @@ def network_init(args, internal_targets): return platform_targets = set(a for t in internal_targets for a in t.aliases if a.startswith('network/')) + net_commands = set(a[4:] for t in internal_targets for a in t.aliases if a.startswith('net_')) instances = [] # type: list [lib.thread.WrappedThread] @@ -383,7 +384,10 @@ def network_init(args, internal_targets): platform, version = platform_version.split('/', 1) platform_target = 'network/%s/' % platform - if platform_target not in platform_targets and 'network/basics/' not in platform_targets: + # check to see if the platform supports any of the platform agnostic tests we're going to run (if any) + platform_agnostic = any(os.path.exists('lib/ansible/modules/network/%s/%s_%s.py' % (platform, platform, command)) for command in net_commands) + + if platform_target not in platform_targets and not platform_agnostic: display.warning('Skipping "%s" because selected tests do not target the "%s" platform.' % ( platform_version, platform)) continue @@ -436,6 +440,7 @@ def network_inventory(remotes): :rtype: str """ groups = dict([(remote.platform, []) for remote in remotes]) + net = [] for remote in remotes: options = dict( @@ -453,6 +458,10 @@ def network_inventory(remotes): ) ) + net.append(remote.platform) + + groups['net:children'] = net + template = '' for group in groups: diff --git a/test/utils/shippable/network.sh b/test/utils/shippable/network.sh index cea47078f4d..24d63722f84 100755 --- a/test/utils/shippable/network.sh +++ b/test/utils/shippable/network.sh @@ -18,9 +18,7 @@ provider="${P:-default}" # python versions to test in order # all versions run full tests python_versions=( - 2.6 2.7 - 3.5 3.6 ) @@ -32,7 +30,6 @@ if [ -s /tmp/network.txt ]; then platforms=( --platform vyos/1.1.8 - --platform ios/csr1000v ) else echo "No changes requiring integration tests specific to networking were detected."