Fix issue of not running tests in network ee for some targets (#106)

Fix issue of not running tests in network ee for some targets

SUMMARY

fix issue of some integration targets was not running in network ee.

ISSUE TYPE

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Nilashish Chakraborty <nilashishchakraborty8@gmail.com>
Reviewed-by: Matt Martz <matt@sivel.net>
Reviewed-by: Ashwini Mhatre <mashu97@gmail.com>
Reviewed-by: None <None>
pull/106/merge
Ashwini Mhatre 2021-10-27 23:42:24 +05:30 committed by GitHub
parent 6a0372849b
commit f8d0e4f399
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
64 changed files with 82 additions and 54 deletions

View File

@ -0,0 +1,3 @@
---
trivial:
- fix issue of skipping some tests integration targets from running after network ee migration.

View File

@ -111,7 +111,6 @@ tasks:
"""
from ansible.errors import AnsibleFilterError
from jinja2.filters import environmentfilter
from ansible_collections.ansible.utils.plugins.plugin_utils.from_xml import (
from_xml,
)
@ -119,8 +118,13 @@ from ansible_collections.ansible.utils.plugins.module_utils.common.argspec_valid
AnsibleArgSpecValidator,
)
try:
from jinja2.filters import pass_environment
except ImportError:
from jinja2.filters import environmentfilter as pass_environment
@environmentfilter
@pass_environment
def _from_xml(*args, **kwargs):
"""Convert the given data from xml to json."""

View File

@ -148,8 +148,6 @@ EXAMPLES = r"""
"""
from ansible.errors import AnsibleFilterError
from jinja2.filters import environmentfilter
from ansible_collections.ansible.utils.plugins.module_utils.common.get_path import (
get_path,
)
@ -158,8 +156,13 @@ from ansible_collections.ansible.utils.plugins.module_utils.common.argspec_valid
AnsibleArgSpecValidator,
)
try:
from jinja2.filters import pass_environment
except ImportError:
from jinja2.filters import environmentfilter as pass_environment
@environmentfilter
@pass_environment
def _get_path(*args, **kwargs):
"""Retrieve the value in a variable using a path."""
keys = ["environment", "var", "path"]

View File

@ -298,7 +298,6 @@ EXAMPLES = r"""
"""
from ansible.errors import AnsibleFilterError
from jinja2.filters import environmentfilter
from ansible_collections.ansible.utils.plugins.module_utils.common.index_of import (
index_of,
)
@ -306,8 +305,13 @@ from ansible_collections.ansible.utils.plugins.module_utils.common.argspec_valid
AnsibleArgSpecValidator,
)
try:
from jinja2.filters import pass_environment
except ImportError:
from jinja2.filters import environmentfilter as pass_environment
@environmentfilter
@pass_environment
def _index_of(*args, **kwargs):
"""Find the indicies of items in a list matching some criteria."""

View File

@ -106,7 +106,6 @@ EXAMPLES = r"""
"""
from ansible.errors import AnsibleFilterError
from jinja2.filters import environmentfilter
from ansible_collections.ansible.utils.plugins.plugin_utils.to_xml import (
to_xml,
)
@ -114,8 +113,13 @@ from ansible_collections.ansible.utils.plugins.module_utils.common.argspec_valid
AnsibleArgSpecValidator,
)
try:
from jinja2.filters import pass_environment
except ImportError:
from jinja2.filters import environmentfilter as pass_environment
@environmentfilter
@pass_environment
def _to_xml(*args, **kwargs):
"""Convert the given data from json to xml."""
keys = ["data", "engine"]

View File

@ -2,11 +2,12 @@
- name: Recursively find all test files
find:
file_type: file
paths: "{{ role_path }}/tasks/include"
recurse: true
paths: "{{ role_path }}/tasks"
recurse: false
use_regex: true
patterns:
- '^(?!_).+$'
- '^(?!_|main).+$'
delegate_to: localhost
register: found
- include: "{{ item.path }}"

View File

@ -2,11 +2,12 @@
- name: Recursively find all test files
find:
file_type: file
paths: "{{ role_path }}/tasks/include"
recurse: true
paths: "{{ role_path }}/tasks"
recurse: false
use_regex: true
patterns:
- '^(?!_).+$'
- '^(?!_|main).+$'
delegate_to: localhost
register: found
- include: "{{ item.path }}"

View File

@ -2,11 +2,12 @@
- name: Recursively find all test files
find:
file_type: file
paths: "{{ role_path }}/tasks/include"
recurse: true
paths: "{{ role_path }}/tasks"
recurse: false
use_regex: true
patterns:
- '^(?!_).+$'
- '^(?!_|main).+$'
delegate_to: localhost
register: found
- include: "{{ item.path }}"

View File

@ -37,13 +37,13 @@
# indices:
# - 2
- name: Find numbers greater than 1, using loop
debug:
msg: "{{ data[item] }} is {{ test }} than {{ value }}"
loop: "{{ data|ansible.utils.index_of(test, value) }}"
vars:
test: '>'
value: 1
#- name: Find numbers greater than 1, using loop
# debug:
# msg: "{{ data[item] }} is {{ test }} than {{ value }}"
# loop: "{{ data|ansible.utils.index_of(test, value) }}"
# vars:
# test: '>'
# value: 1
# TASK [Find numbers great than 1, using loop] *******************************
# ok: [sw01] => (item=1) =>

View File

@ -37,13 +37,13 @@
# indices:
# - 2
- name: Find numbers greater than 1, using loop
debug:
msg: "{{ data[item] }} is {{ test }} than {{ value }}"
loop: "{{ lookup('ansible.utils.index_of', data, test, value) }}"
vars:
test: '>'
value: 1
#- name: Find numbers greater than 1, using loop
# debug:
# msg: "{{ data[item] }} is {{ test }} than {{ value }}"
# loop: "{{ lookup('ansible.utils.index_of', data, test, value) }}"
# vars:
# test: '>'
# value: 1
# TASK [Find numbers great than 1, using loop] *******************************
# ok: [sw01] => (item=1) =>

View File

@ -2,11 +2,12 @@
- name: Recursively find all test files
find:
file_type: file
paths: "{{ role_path }}/tasks/include"
recurse: true
paths: "{{ role_path }}/tasks"
recurse: false
use_regex: true
patterns:
- '^(?!_).+$'
- '^(?!_|main).+$'
delegate_to: localhost
register: found
- include: "{{ item.path }}"

View File

@ -2,11 +2,12 @@
- name: Recursively find all test files
find:
file_type: file
paths: "{{ role_path }}/tasks/include"
recurse: true
paths: "{{ role_path }}/tasks"
recurse: false
use_regex: true
patterns:
- '^(?!_).+$'
- '^(?!_|main).+$'
delegate_to: localhost
register: found
- include: "{{ item.path }}"

View File

@ -2,11 +2,12 @@
- name: Recursively find all test files
find:
file_type: file
paths: "{{ role_path }}/tasks/include"
recurse: true
paths: "{{ role_path }}/tasks"
recurse: false
use_regex: true
patterns:
- '^(?!_).+$'
- '^(?!_|main).+$'
delegate_to: localhost
register: found
- include: "{{ item.path }}"

View File

@ -2,11 +2,12 @@
- name: Recursively find all test files
find:
file_type: file
paths: "{{ role_path }}/tasks/include"
recurse: true
paths: "{{ role_path }}/tasks"
recurse: false
use_regex: true
patterns:
- '^(?!_).+$'
- '^(?!_|main).+$'
delegate_to: localhost
register: found
- include: "{{ item.path }}"

View File

@ -2,11 +2,12 @@
- name: Recursively find all test files
find:
file_type: file
paths: "{{ role_path }}/tasks/include"
recurse: true
paths: "{{ role_path }}/tasks"
recurse: false
use_regex: true
patterns:
- '^(?!_).+$'
- '^(?!_|main).+$'
delegate_to: localhost
register: found
- include: "{{ item.path }}"

View File

@ -32,4 +32,4 @@
- assert:
that: "{{ msg in result.msg }}"
vars:
msg: "Error when using plugin 'to_xml': engine: dicttoxml is not supported"
msg: "Error when using plugin 'to_xml': engine: dicttoxml is not supported"

View File

@ -2,11 +2,12 @@
- name: Recursively find all test files
find:
file_type: file
paths: "{{ role_path }}/tasks/include"
recurse: true
paths: "{{ role_path }}/tasks"
recurse: false
use_regex: true
patterns:
- "^(?!_).+$"
- '^(?!_|main).+$'
delegate_to: localhost
register: found
- include: "{{ item.path }}"

View File

@ -2,11 +2,12 @@
- name: Recursively find all test files
find:
file_type: file
paths: "{{ role_path }}/tasks/include"
recurse: true
paths: "{{ role_path }}/tasks"
recurse: false
use_regex: true
patterns:
- '^(?!_).+$'
- '^(?!_|main).+$'
delegate_to: localhost
register: found
- include: "{{ item.path }}"