mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[stable-6] Fix bad expressions in tests (#7627)
* Fix bad expressions in tests (#7625) * Fix bad expressions in tests. ci_complete * Disable cmd_runner integration tests. ci_complete * Another bad expression. ci_complete (cherry picked from commit3b779ecade
) * Fix osx_defaults tests (#7631) Fix osx_defaults tests. (cherry picked from commitdbba0d1956
)
This commit is contained in:
parent
e6c2a12a4a
commit
1f60829b9d
7 changed files with 42 additions and 27 deletions
|
@ -22,7 +22,7 @@
|
|||
assert:
|
||||
that:
|
||||
- 'alternative is changed'
|
||||
- 'cmd.stdout == "dummy{{ item }}"'
|
||||
- 'cmd.stdout == "dummy" ~ item'
|
||||
|
||||
- name: check that alternative has been updated
|
||||
command: "grep -Pzq '/bin/dummy{{ item }}\\n{{ 60 + item|int }}' '{{ alternatives_dir }}/dummy'"
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
that:
|
||||
- archive_no_options is changed
|
||||
- "archive_no_options.dest_state == 'archive'"
|
||||
- "{{ archive_no_options.archived | length }} == 3"
|
||||
- "archive_no_options.archived | length == 3"
|
||||
|
||||
- name: Remove the archive - no options ({{ format }})
|
||||
file:
|
||||
|
@ -54,7 +54,7 @@
|
|||
that:
|
||||
- archive_file_options_stat is not changed
|
||||
- "archive_file_options.mode == '0600'"
|
||||
- "{{ archive_file_options.archived | length }} == 3"
|
||||
- "archive_file_options.archived | length == 3"
|
||||
|
||||
- name: Remove the archive - file options ({{ format }})
|
||||
file:
|
||||
|
@ -146,7 +146,7 @@
|
|||
assert:
|
||||
that:
|
||||
- archive_path_list is changed
|
||||
- "{{ archive_path_list.archived | length }} == 3"
|
||||
- "archive_path_list.archived | length == 3"
|
||||
|
||||
- name: Remove archive - path list ({{ format }})
|
||||
file:
|
||||
|
@ -168,8 +168,8 @@
|
|||
that:
|
||||
- archive_missing_paths is changed
|
||||
- "archive_missing_paths.dest_state == 'incomplete'"
|
||||
- "'{{ remote_tmp_dir }}/dne.txt' in archive_missing_paths.missing"
|
||||
- "'{{ remote_tmp_dir }}/foo.txt' not in archive_missing_paths.missing"
|
||||
- "(remote_tmp_dir ~ '/dne.txt') in archive_missing_paths.missing"
|
||||
- "(remote_tmp_dir ~ '/foo.txt') not in archive_missing_paths.missing"
|
||||
|
||||
- name: Remove archive - missing paths ({{ format }})
|
||||
file:
|
||||
|
|
|
@ -20,21 +20,28 @@
|
|||
assert:
|
||||
that:
|
||||
- archive_remove_source_files is changed
|
||||
- "{{ archive_remove_source_files.archived | length }} == 3"
|
||||
- "archive_remove_source_files.archived | length == 3"
|
||||
|
||||
- name: Remove Archive - remove source files ({{ format }})
|
||||
file:
|
||||
path: "{{ remote_tmp_dir }}/archive_remove_source_files.{{ format }}"
|
||||
state: absent
|
||||
|
||||
- name: Assert that source files were removed - remove source files ({{ format }})
|
||||
assert:
|
||||
that:
|
||||
- "'{{ remote_tmp_dir }}/{{ item }}' is not exists"
|
||||
- name: Remove source files in check mode ({{ format }})
|
||||
file:
|
||||
path: "{{ remote_tmp_dir }}/{{ item }}"
|
||||
state: absent
|
||||
check_mode: true
|
||||
with_items:
|
||||
- foo.txt
|
||||
- bar.txt
|
||||
- empty.txt
|
||||
register: remove_files
|
||||
|
||||
- name: Assert that source files were removed - remove source files ({{ format }})
|
||||
assert:
|
||||
that:
|
||||
- remove_files is not changed
|
||||
|
||||
- name: Copy source files - remove source directory ({{ format }})
|
||||
copy:
|
||||
|
@ -76,17 +83,24 @@
|
|||
assert:
|
||||
that:
|
||||
- archive_remove_source_directory is changed
|
||||
- "{{ archive_remove_source_directory.archived | length }} == 3"
|
||||
- "archive_remove_source_directory.archived | length == 3"
|
||||
|
||||
- name: Remove archive - remove source directory ({{ format }})
|
||||
file:
|
||||
path: "{{ remote_tmp_dir }}/archive_remove_source_directory.{{ format }}"
|
||||
state: absent
|
||||
|
||||
- name: Remove source source directory in check mode ({{ format }})
|
||||
file:
|
||||
path: "{{ remote_tmp_dir }}/tmpdir"
|
||||
state: absent
|
||||
check_mode: true
|
||||
register: remove_dir
|
||||
|
||||
- name: Verify source directory was removed - remove source directory ({{ format }})
|
||||
assert:
|
||||
that:
|
||||
- "'{{ remote_tmp_dir }}/tmpdir' is not exists"
|
||||
- remove_dir is not changed
|
||||
|
||||
- name: Create temporary directory - remove source excluding path ({{ format }})
|
||||
file:
|
||||
|
@ -120,7 +134,7 @@
|
|||
assert:
|
||||
that:
|
||||
- archive_remove_source_excluding_path is changed
|
||||
- "{{ archive_remove_source_excluding_path.archived | length }} == 2"
|
||||
- "archive_remove_source_excluding_path.archived | length == 2"
|
||||
|
||||
- name: Remove archive - remove source excluding path ({{ format }})
|
||||
file:
|
||||
|
|
|
@ -3,3 +3,4 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
azp/posix/2
|
||||
disabled # TODO
|
||||
|
|
|
@ -17,25 +17,25 @@
|
|||
assert:
|
||||
that:
|
||||
- "'project_path' in deploy_helper"
|
||||
- "deploy_helper.current_path == '{{ deploy_helper.project_path }}/current'"
|
||||
- "deploy_helper.releases_path == '{{ deploy_helper.project_path }}/releases'"
|
||||
- "deploy_helper.shared_path == '{{ deploy_helper.project_path }}/shared'"
|
||||
- "deploy_helper.current_path == deploy_helper.project_path ~ '/current'"
|
||||
- "deploy_helper.releases_path == deploy_helper.project_path ~ '/releases'"
|
||||
- "deploy_helper.shared_path == deploy_helper.project_path ~ '/shared'"
|
||||
- "deploy_helper.unfinished_filename == 'DEPLOY_UNFINISHED'"
|
||||
- "'previous_release' in deploy_helper"
|
||||
- "'previous_release_path' in deploy_helper"
|
||||
- "'new_release' in deploy_helper"
|
||||
- "'new_release_path' in deploy_helper"
|
||||
- "deploy_helper.new_release_path == '{{ deploy_helper.releases_path }}/{{ deploy_helper.new_release }}'"
|
||||
- "deploy_helper.new_release_path == deploy_helper.releases_path ~ '/' ~ deploy_helper.new_release"
|
||||
|
||||
- name: State=query with relative overridden paths
|
||||
deploy_helper: path={{ deploy_helper_test_root }} current_path=CURRENT_PATH releases_path=RELEASES_PATH shared_path=SHARED_PATH state=query
|
||||
- name: Assert State=query with relative overridden paths
|
||||
assert:
|
||||
that:
|
||||
- "deploy_helper.current_path == '{{ deploy_helper.project_path }}/CURRENT_PATH'"
|
||||
- "deploy_helper.releases_path == '{{ deploy_helper.project_path }}/RELEASES_PATH'"
|
||||
- "deploy_helper.shared_path == '{{ deploy_helper.project_path }}/SHARED_PATH'"
|
||||
- "deploy_helper.new_release_path == '{{ deploy_helper.releases_path }}/{{ deploy_helper.new_release}}'"
|
||||
- "deploy_helper.current_path == deploy_helper.project_path ~ '/CURRENT_PATH'"
|
||||
- "deploy_helper.releases_path == deploy_helper.project_path ~ '/RELEASES_PATH'"
|
||||
- "deploy_helper.shared_path == deploy_helper.project_path ~ '/SHARED_PATH'"
|
||||
- "deploy_helper.new_release_path == deploy_helper.releases_path ~ '/' ~ deploy_helper.new_release"
|
||||
|
||||
- name: State=query with absolute overridden paths
|
||||
deploy_helper: path={{ deploy_helper_test_root }} current_path=/CURRENT_PATH releases_path=/RELEASES_PATH shared_path=/SHARED_PATH state=query
|
||||
|
@ -45,7 +45,7 @@
|
|||
- "deploy_helper.current_path == '/CURRENT_PATH'"
|
||||
- "deploy_helper.releases_path == '/RELEASES_PATH'"
|
||||
- "deploy_helper.shared_path == '/SHARED_PATH'"
|
||||
- "deploy_helper.new_release_path == '{{ deploy_helper.releases_path }}/{{ deploy_helper.new_release}}'"
|
||||
- "deploy_helper.new_release_path == deploy_helper.releases_path ~ '/' ~ deploy_helper.new_release"
|
||||
|
||||
- name: State=query with overridden unfinished_filename
|
||||
deploy_helper: path={{ deploy_helper_test_root }} unfinished_filename=UNFINISHED_DEPLOY state=query
|
||||
|
|
|
@ -39,4 +39,4 @@
|
|||
that:
|
||||
- result_basic_2 is not changed
|
||||
- result_basic_2 is failed
|
||||
- result_basic_2.msg == "Destination {{ non_existing_file }} does not exist!"
|
||||
- result_basic_2.msg == "Destination " ~ non_existing_file ~ " does not exist!"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
- name: Test if state and value are required together
|
||||
assert:
|
||||
that:
|
||||
- "'following are missing: value' in '{{ missing_value['msg'] }}'"
|
||||
- "'following are missing: value' in missing_value['msg']"
|
||||
|
||||
- name: Change value of AppleMeasurementUnits to centimeter in check_mode
|
||||
osx_defaults:
|
||||
|
@ -194,7 +194,7 @@
|
|||
register: test_data_types
|
||||
|
||||
- assert:
|
||||
that: "{{ item.changed }}"
|
||||
that: "item is changed"
|
||||
with_items: "{{ test_data_types.results }}"
|
||||
|
||||
- name: Use different data types and delete them
|
||||
|
@ -208,7 +208,7 @@
|
|||
register: test_data_types
|
||||
|
||||
- assert:
|
||||
that: "{{ item.changed }}"
|
||||
that: "item is changed"
|
||||
with_items: "{{ test_data_types.results }}"
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue