From 62957c9fc0802623c84b0cf387e10f3f6ea23dc8 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Tue, 10 Apr 2018 12:00:14 -0700 Subject: [PATCH] Support network action plugin classification. --- test/integration/target-prefixes.network | 10 +++++- test/runner/lib/classification.py | 43 +++++++++++++++++++++++- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/test/integration/target-prefixes.network b/test/integration/target-prefixes.network index 0efe28c6fd2..5849638123f 100644 --- a/test/integration/target-prefixes.network +++ b/test/integration/target-prefixes.network @@ -1,17 +1,25 @@ a10 aci +aireos +aruba asa bigip +ce cl +dellos10 dellos6 dellos9 -dellos10 +edgeos +enos eos ios iosxr +ironware junos net +netconf nxos +onyx openvswitch ops pn diff --git a/test/runner/lib/classification.py b/test/runner/lib/classification.py index 30d734ee6be..86bbe647823 100644 --- a/test/runner/lib/classification.py +++ b/test/runner/lib/classification.py @@ -3,6 +3,7 @@ from __future__ import absolute_import, print_function import os +import re import time from lib.target import ( @@ -288,6 +289,46 @@ class PathMapper(object): if ext == '.py': return minimal # already expanded using get_dependent_paths + if path.startswith('lib/ansible/plugins/action/'): + if ext == '.py': + if name.startswith('net_'): + network_target = 'network/.*_%s' % name[4:] + + if any(re.search(r'^%s$' % network_target, alias) for alias in self.integration_targets_by_alias): + return { + 'network-integration': network_target, + 'units': 'all', + } + + return { + 'network-integration': self.integration_all_target, + 'units': 'all', + } + + if self.prefixes.get(name) == 'network': + network_platform = name + elif name.endswith('_config') and self.prefixes.get(name[:-7]) == 'network': + network_platform = name[:-7] + elif name.endswith('_template') and self.prefixes.get(name[:-9]) == 'network': + network_platform = name[:-9] + else: + network_platform = None + + if network_platform: + network_target = 'network/%s/' % network_platform + + if network_target in self.integration_targets_by_alias: + return { + 'network-integration': network_target, + 'units': 'all', + } + + display.warning('Integration tests for "%s" not found.' % network_target, unique=True) + + return { + 'units': 'all', + } + if path.startswith('lib/ansible/plugins/connection/'): if name == '__init__': return { @@ -348,7 +389,7 @@ class PathMapper(object): 'units': 'all', } - display.warning('Integration tests for "%s" not found.' % network_target) + display.warning('Integration tests for "%s" not found.' % network_target, unique=True) return { 'units': 'all',