1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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.
This commit is contained in:
Matt Clay 2018-01-09 14:52:36 -08:00 committed by GitHub
parent 55352bdda4
commit 82b5a6a0c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View file

@ -373,6 +373,7 @@ def network_init(args, internal_targets):
return return
platform_targets = set(a for t in internal_targets for a in t.aliases if a.startswith('network/')) 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] instances = [] # type: list [lib.thread.WrappedThread]
@ -383,7 +384,10 @@ def network_init(args, internal_targets):
platform, version = platform_version.split('/', 1) platform, version = platform_version.split('/', 1)
platform_target = 'network/%s/' % platform 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.' % ( display.warning('Skipping "%s" because selected tests do not target the "%s" platform.' % (
platform_version, platform)) platform_version, platform))
continue continue
@ -436,6 +440,7 @@ def network_inventory(remotes):
:rtype: str :rtype: str
""" """
groups = dict([(remote.platform, []) for remote in remotes]) groups = dict([(remote.platform, []) for remote in remotes])
net = []
for remote in remotes: for remote in remotes:
options = dict( options = dict(
@ -453,6 +458,10 @@ def network_inventory(remotes):
) )
) )
net.append(remote.platform)
groups['net:children'] = net
template = '' template = ''
for group in groups: for group in groups:

View file

@ -18,9 +18,7 @@ provider="${P:-default}"
# python versions to test in order # python versions to test in order
# all versions run full tests # all versions run full tests
python_versions=( python_versions=(
2.6
2.7 2.7
3.5
3.6 3.6
) )
@ -32,7 +30,6 @@ if [ -s /tmp/network.txt ]; then
platforms=( platforms=(
--platform vyos/1.1.8 --platform vyos/1.1.8
--platform ios/csr1000v
) )
else else
echo "No changes requiring integration tests specific to networking were detected." echo "No changes requiring integration tests specific to networking were detected."