Remove include from tests (#74330)
This commit is contained in:
parent
9369bd6ca1
commit
d44eb03f49
26 changed files with 56 additions and 43 deletions
|
@ -518,7 +518,7 @@ The following example walks through the integration tests for the ``vyos.vyos.vy
|
|||
.. code-block:: yaml
|
||||
|
||||
---
|
||||
- include: cli.yaml
|
||||
- import_tasks: cli.yaml
|
||||
tags:
|
||||
- cli
|
||||
|
||||
|
@ -538,13 +538,20 @@ The following example walks through the integration tests for the ``vyos.vyos.vy
|
|||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test cases (connection=network_cli)
|
||||
include: "{{ test_case_to_run }} ansible_connection=network_cli"
|
||||
include_tasks:
|
||||
file: "{{ test_case_to_run }}"
|
||||
vars:
|
||||
ansible_connection: network_cli
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
- name: run test case (connection=local)
|
||||
include: "{{ test_case_to_run }} ansible_connection=local ansible_become=no"
|
||||
include_tasks:
|
||||
file: "{{ test_case_to_run }}"
|
||||
vars:
|
||||
ansible_connection: local
|
||||
ansible_become: no
|
||||
with_first_found: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
@ -558,11 +565,11 @@ The following example walks through the integration tests for the ``vyos.vyos.vy
|
|||
msg: START vyos_l3_interfaces merged integration tests on connection={{ ansible_connection
|
||||
}}
|
||||
|
||||
- include_tasks: _remove_config.yaml
|
||||
- import_tasks: _remove_config.yaml
|
||||
|
||||
- block:
|
||||
|
||||
- include_tasks: _populate.yaml
|
||||
- import_tasks: _populate.yaml
|
||||
|
||||
- name: Overrides all device configuration with provided configuration
|
||||
register: result
|
||||
|
@ -613,7 +620,7 @@ The following example walks through the integration tests for the ``vyos.vyos.vy
|
|||
\ == 0 }}"
|
||||
always:
|
||||
|
||||
- include_tasks: _remove_config.yaml
|
||||
- import_tasks: _remove_config.yaml
|
||||
|
||||
|
||||
Detecting test resources at runtime
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
hosts: testhost,testhost2
|
||||
any_errors_fatal: True
|
||||
tasks:
|
||||
- include: test_fatal.yml
|
||||
- import_tasks: test_fatal.yml
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- include_vars: default.yml
|
||||
|
||||
- include: default.yml
|
||||
- include: sudo.yml
|
||||
- include: su.yml
|
||||
- import_tasks: default.yml
|
||||
- import_tasks: sudo.yml
|
||||
- import_tasks: su.yml
|
||||
|
|
|
@ -96,8 +96,8 @@
|
|||
tasks:
|
||||
- block:
|
||||
- name: include fail.yml in tasks
|
||||
include: fail.yml
|
||||
args:
|
||||
import_tasks: fail.yml
|
||||
vars:
|
||||
msg: "failed from tasks"
|
||||
- name: tasks flag should not be set after failure
|
||||
set_fact:
|
||||
|
@ -106,8 +106,8 @@
|
|||
- set_fact:
|
||||
rescue_run_after_include_fail: true
|
||||
- name: include fail.yml in rescue
|
||||
include: fail.yml
|
||||
args:
|
||||
import_tasks: fail.yml
|
||||
vars:
|
||||
msg: "failed from rescue"
|
||||
- name: flag should not be set after failure in rescue
|
||||
set_fact:
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
- include: fail.yml
|
||||
args:
|
||||
- import_tasks: fail.yml
|
||||
vars:
|
||||
msg: "nested {{msg}}"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
- include: nested_fail.yml
|
||||
args:
|
||||
- import_tasks: nested_fail.yml
|
||||
vars:
|
||||
msg: "nested {{msg}}"
|
||||
|
|
|
@ -1489,13 +1489,13 @@
|
|||
# src is a file, dest is a non-existent directory (2 levels of directories):
|
||||
# using remote_src
|
||||
# checks that dest is created
|
||||
- include: dest_in_non_existent_directories_remote_src.yml
|
||||
- include_tasks: file=dest_in_non_existent_directories_remote_src.yml
|
||||
with_items:
|
||||
- { src: 'foo.txt', dest: 'new_sub_dir1/sub_dir2/', check: 'new_sub_dir1/sub_dir2/foo.txt' }
|
||||
|
||||
# src is a file, dest is file in a non-existent directory: checks that a failure occurs
|
||||
# using remote_src
|
||||
- include: src_file_dest_file_in_non_existent_dir_remote_src.yml
|
||||
- include_tasks: file=src_file_dest_file_in_non_existent_dir_remote_src.yml
|
||||
with_items:
|
||||
- 'new_sub_dir1/sub_dir2/foo.txt'
|
||||
- 'new_sub_dir1/foo.txt'
|
||||
|
@ -1504,7 +1504,7 @@
|
|||
|
||||
# src is a file, dest is a non-existent directory (2 levels of directories):
|
||||
# checks that dest is created
|
||||
- include: dest_in_non_existent_directories.yml
|
||||
- include_tasks: file=dest_in_non_existent_directories.yml
|
||||
with_items:
|
||||
- { src: 'foo.txt', dest: 'new_sub_dir1/sub_dir2/', check: 'new_sub_dir1/sub_dir2/foo.txt' }
|
||||
- { src: 'subdir', dest: 'new_sub_dir1/sub_dir2/', check: 'new_sub_dir1/sub_dir2/subdir/bar.txt' }
|
||||
|
@ -1513,7 +1513,7 @@
|
|||
- { src: 'subdir/', dest: 'new_sub_dir1/sub_dir2', check: 'new_sub_dir1/sub_dir2/bar.txt' }
|
||||
|
||||
# src is a file, dest is file in a non-existent directory: checks that a failure occurs
|
||||
- include: src_file_dest_file_in_non_existent_dir.yml
|
||||
- include_tasks: file=src_file_dest_file_in_non_existent_dir.yml
|
||||
with_items:
|
||||
- 'new_sub_dir1/sub_dir2/foo.txt'
|
||||
- 'new_sub_dir1/foo.txt'
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
- include: 'dpkg_selections.yaml'
|
||||
- include_tasks: file='dpkg_selections.yaml'
|
||||
when: ansible_distribution in ('Ubuntu', 'Debian')
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# File module tests for overwriting directories
|
||||
- name: Initialize the test output dir
|
||||
include: initialize.yml
|
||||
import_tasks: initialize.yml
|
||||
|
||||
# We need to make this more consistent:
|
||||
# https://github.com/ansible/proposals/issues/111
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: Initialize the test output dir
|
||||
include: initialize.yml
|
||||
import_tasks: initialize.yml
|
||||
|
||||
- name: touch a file for testing
|
||||
file: path={{output_dir}}/foo-se.txt state=touch
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# file module tests for dealing with symlinks (state=link)
|
||||
|
||||
- name: Initialize the test output dir
|
||||
include: initialize.yml
|
||||
import_tasks: initialize.yml
|
||||
|
||||
#
|
||||
# Basic absolute symlink to a file
|
||||
|
|
|
@ -1 +1 @@
|
|||
- include: handlers.yml
|
||||
- import_tasks: handlers.yml
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
notify: test handler
|
||||
tags: ['playbook_include_handlers']
|
||||
handlers:
|
||||
- include: handlers.yml
|
||||
- import_tasks: handlers.yml
|
||||
|
||||
- name: verify that role can include handler
|
||||
hosts: testhost
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test cases (connection=ansible.netcommon.network_cli)
|
||||
include: "{{ test_case_to_run }}"
|
||||
include_tasks: "{{ test_case_to_run }}"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
---
|
||||
- { include: cli.yaml, tags: ['cli'] }
|
||||
- { import_tasks: cli.yaml, tags: ['cli'] }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- include: ubuntu.yml
|
||||
- include_tasks: ubuntu.yml
|
||||
when:
|
||||
- ansible_distribution == 'Ubuntu'
|
||||
- ansible_distribution_release != 'focal'
|
||||
|
|
|
@ -10,13 +10,17 @@
|
|||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case (connection=ansible.netcommon.network_cli)
|
||||
include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli"
|
||||
include_tasks: "file={{ test_case_to_run }}"
|
||||
vars:
|
||||
ansible_connection: ansible.netcommon.network_cli
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
- name: run test case (connection=local)
|
||||
include: "{{ test_case_to_run }} ansible_connection=local"
|
||||
include_tasks: "file={{ test_case_to_run }}"
|
||||
vars:
|
||||
ansible_connection: local
|
||||
with_first_found: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case (connection=ansible.netcommon.network_cli)
|
||||
include: "{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli"
|
||||
include_tasks: "file={{ test_case_to_run }}"
|
||||
vars:
|
||||
ansible_connection: ansible.netcommon.network_cli
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
- {include: cli.yaml, tags: ['cli']}
|
||||
- {include: cli_config.yaml, tags: ['cli_config']}
|
||||
- {import_tasks: cli.yaml, tags: ['cli']}
|
||||
- {import_tasks: cli_config.yaml, tags: ['cli_config']}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: Run test case (connection=ansible.netcommon.network_cli)
|
||||
include: "{{ test_case_to_run }}"
|
||||
include_tasks: "{{ test_case_to_run }}"
|
||||
vars:
|
||||
ansible_connection: ansible.netcommon.network_cli
|
||||
with_items: "{{ test_items }}"
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
---
|
||||
- {include: cli.yaml, tags: ['cli']}
|
||||
- {import_tasks: cli.yaml, tags: ['cli']}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
---
|
||||
- include: pre_test.yml
|
||||
- import_tasks: pre_test.yml
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
- name: Run tests
|
||||
block:
|
||||
- include: tests.yml
|
||||
- import_tasks: tests.yml
|
||||
always:
|
||||
- name: Detach disk
|
||||
win_command: diskpart.exe /s {{ remote_tmp_dir }}\partition_deletion_script.txt
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
- include: 'rpm_key.yaml'
|
||||
- include_tasks: 'rpm_key.yaml'
|
||||
when: ansible_os_family == "RedHat"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
- set_fact:
|
||||
temppath: "{{ remote_tmp_dir }}/output.txt"
|
||||
|
||||
- include: taskorder-include.yml
|
||||
- include_tasks: taskorder-include.yml
|
||||
with_items:
|
||||
- 1
|
||||
- 2
|
||||
|
|
|
@ -716,4 +716,4 @@
|
|||
that: "\"'y' is undefined\" in error.msg"
|
||||
|
||||
# aliases file requires root for template tests so this should be safe
|
||||
- include: backup_test.yml
|
||||
- import_tasks: backup_test.yml
|
||||
|
|
Loading…
Add table
Reference in a new issue