Deprecate tests used as filters (#32361)

* Warn on tests used as filters

* Update docs, add aliases for tests that fit more gramatically with test syntax

* Fix rst formatting

* Add successful filter, alias of success

* Remove renamed_deprecation, it was overkill

* Make directory alias for is_dir

* Update tests to use proper jinja test syntax

* Update additional documentation, living outside of YAML files, to reflect proper jinja test syntax

* Add conversion script, porting guide updates, and changelog updates

* Update newly added uses of tests as filters

* No underscore variable

* Convert recent tests as filter changes to win_stat

* Fix some changes related to rebasing a few integration tests

* Make tests_as_filters_warning explicitly accept the name of the test, instead of inferring the name

* Add test for tests_as_filters_warning

* Update tests as filters in newly added/modified tests

* Address recent changes to several integration tests

* Address recent changes in cs_vpc
This commit is contained in:
Matt Martz 2017-11-27 16:58:08 -06:00 committed by ansibot
parent fd4a6cf7ad
commit 4fe08441be
349 changed files with 4086 additions and 3844 deletions

View file

@ -18,7 +18,7 @@
that: (git_archive.results | map(attribute='changed') | unique | list)[0]
when:
- "ansible_os_family == 'RedHat'"
- ansible_distribution_major_version | version_compare('7', '>=')
- ansible_distribution_major_version is version('7', '>=')
- name: ARCHIVE | Check if archive file is created or not
stat:
@ -31,7 +31,7 @@
that: (archive_check.results | map(attribute='stat.exists') | unique | list)[0]
when:
- "ansible_os_family == 'RedHat'"
- ansible_distribution_major_version | version_compare('7', '>=')
- ansible_distribution_major_version is version('7', '>=')
- name: ARCHIVE | Clear checkout_dir
file:
@ -60,7 +60,7 @@
that: (git_archive.results | map(attribute='changed') | unique | list)[0]
when:
- "ansible_os_family == 'RedHat'"
- ansible_distribution_major_version | version_compare('7', '>=')
- ansible_distribution_major_version is version('7', '>=')
- name: ARCHIVE | Check if archive file is created or not
stat:
@ -73,4 +73,4 @@
that: (archive_check.results | map(attribute='stat.exists') | unique | list)[0]
when:
- "ansible_os_family == 'RedHat'"
- ansible_distribution_major_version | version_compare('7', '>=')
- ansible_distribution_major_version is version('7', '>=')

View file

@ -18,7 +18,7 @@
register: clone2
- assert:
that: "clone2|success"
that: "clone2 is successful"
- name: CHANGE-REPO-URL | check url updated
shell: git remote show origin | grep Fetch
@ -63,7 +63,7 @@
- name: CHANGE-REPO-URL | check repo not changed
assert:
that:
- not checkout_same_url|changed
- checkout_same_url is not changed
- name: CHANGE-REPO-URL | clone repo with new url to same destination
@ -75,7 +75,7 @@
- name: CHANGE-REPO-URL | check repo changed
assert:
that:
- checkout_new_url|changed
- checkout_new_url is changed
- name: CHANGE-REPO-URL | clone repo with new url in check mode
@ -88,8 +88,8 @@
- name: CHANGE-REPO-URL | check repo reported changed in check mode
assert:
that:
- checkout_new_url_check_mode | changed
when: git_version.stdout | version_compare(git_version_supporting_ls_remote, '>=')
- checkout_new_url_check_mode is changed
when: git_version.stdout is version(git_version_supporting_ls_remote, '>=')
- name: CHANGE-REPO-URL | clone repo with new url after check mode
git:
@ -100,7 +100,7 @@
- name: CHANGE-REPO-URL | check repo still changed after check mode
assert:
that:
- checkout_new_url_after_check_mode|changed
- checkout_new_url_after_check_mode is changed
# Test that checkout by branch works when the branch is not in our current repo but the sha is

View file

@ -44,7 +44,7 @@
- name: check new head
assert:
that:
- not update_new_tag|changed
- update_new_tag is not changed
- "'newtag' in listoftags.stdout_lines"

View file

@ -21,7 +21,7 @@
- name: DEPTH | make sure the old commit was not fetched
assert:
that: 'checkout_early.rc != 0'
when: git_version.stdout | version_compare(git_version_supporting_depth, '>=')
when: git_version.stdout is version(git_version_supporting_depth, '>=')
# tests https://github.com/ansible/ansible/issues/14954
- name: DEPTH | fetch repo again with depth=1
@ -32,8 +32,8 @@
register: checkout2
- assert:
that: "not checkout2|changed"
when: git_version.stdout | version_compare(git_version_supporting_depth, '>=')
that: "checkout2 is not changed"
when: git_version.stdout is version(git_version_supporting_depth, '>=')
- name: DEPTH | again try to access earlier commit
shell: "git checkout {{git_shallow_head_1.stdout}}"
@ -45,7 +45,7 @@
- name: DEPTH | again make sure the old commit was not fetched
assert:
that: 'checkout_early.rc != 0'
when: git_version.stdout | version_compare(git_version_supporting_depth, '>=')
when: git_version.stdout is version(git_version_supporting_depth, '>=')
# make sure we are still able to fetch other versions
- name: DEPTH | Clone same repo with older version
@ -57,7 +57,7 @@
register: cloneold
- assert:
that: cloneold | success
that: cloneold is successful
- name: DEPTH | try to access earlier commit
shell: "git checkout {{git_shallow_head_1.stdout}}"
@ -79,7 +79,7 @@
register: cloneold
- assert:
that: cloneold | success
that: cloneold is successful
- name: DEPTH | clear checkout_dir
file:
@ -107,7 +107,7 @@
- name: DEPTH | ensure the fetch succeeded
assert:
that: git_fetch | success
that: git_fetch is successful
- name: DEPTH | clear checkout_dir
@ -132,7 +132,7 @@
- name: DEPTH | ensure the fetch succeeded
assert:
that: git_fetch | success
that: git_fetch is successful
- name: DEPTH | clear checkout_dir
file:
@ -165,7 +165,7 @@
assert:
that:
- "{{ lookup('file', checkout_dir+'/a' )}} == 3"
- git_fetch | changed
- git_fetch is changed
- name: DEPTH | clear checkout_dir
file:

View file

@ -99,8 +99,8 @@
- name: GPG-VERIFICATION | Check that unsigned lightweight tag verification failed
assert:
that:
- git_verify|failed
- git_verify.msg|match("Failed to verify GPG signature of commit/tag.+")
- git_verify is failed
- git_verify.msg is match("Failed to verify GPG signature of commit/tag.+")
- name: GPG-VERIFICATION | Clone repo and verify a signed commit
environment:
@ -125,8 +125,8 @@
- name: GPG-VERIFICATION | Check that unsigned commit verification failed
assert:
that:
- git_verify|failed
- git_verify.msg|match("Failed to verify GPG signature of commit/tag.+")
- git_verify is failed
- git_verify.msg is match("Failed to verify GPG signature of commit/tag.+")
- name: GPG-VERIFICATION | Clone repo and verify a signed annotated tag
environment:
@ -151,8 +151,8 @@
- name: GPG-VERIFICATION | Check that unsigned annotated tag verification failed
assert:
that:
- git_verify|failed
- git_verify.msg|match("Failed to verify GPG signature of commit/tag.+")
- git_verify is failed
- git_verify.msg is match("Failed to verify GPG signature of commit/tag.+")
- name: GPG-VERIFICATION | Clone repo and verify a signed branch
environment:
@ -177,8 +177,8 @@
- name: GPG-VERIFICATION | Check that unsigned branch verification failed
assert:
that:
- git_verify|failed
- git_verify.msg|match("Failed to verify GPG signature of commit/tag.+")
- git_verify is failed
- git_verify.msg is match("Failed to verify GPG signature of commit/tag.+")
- name: GPG-VERIFICATION | Remove GnuPG verification workdir
file:

View file

@ -29,7 +29,7 @@
- name: LOCALMODS | check fetch with localmods failed
assert:
that:
- git_fetch|failed
- git_fetch is failed
- name: LOCALMODS | fetch with local mods with force
git:
@ -43,7 +43,7 @@
assert:
that:
- "{{ lookup('file', checkout_dir+'/a' )}} == 2"
- git_fetch_force|changed
- git_fetch_force is changed
- name: LOCALMODS | clear checkout_dir
file: state=absent path={{ checkout_dir }}
@ -81,7 +81,7 @@
- name: LOCALMODS | check fetch with localmods failed
assert:
that:
- git_fetch|failed
- git_fetch is failed
- name: LOCALMODS | fetch with local mods with force
git:
@ -96,7 +96,7 @@
assert:
that:
- "{{ lookup('file', checkout_dir+'/a' )}} == 2"
- git_fetch_force|changed
- git_fetch_force is changed
- name: LOCALMODS | clear checkout_dir
file: state=absent path={{ checkout_dir }}

View file

@ -31,7 +31,7 @@
when:
- not gpg_version.stderr
- gpg_version.stdout
- git_version.stdout | version_compare("2.1.0", '>=')
- git_version.stdout is version("2.1.0", '>=')
- include_tasks: localmods.yml
- include_tasks: reset-origin.yml
- include_tasks: ambiguous-ref.yml

View file

@ -8,7 +8,7 @@
- assert:
that:
- git_result | failed
- git_result is failed
- name: MISSING-HOSTKEY | checkout git@github.com repo with accept_hostkey (expected pass)
git:
@ -22,7 +22,7 @@
- assert:
that:
- git_result | changed
- git_result is changed
when: github_ssh_private_key is defined
- name: MISSING-HOSTKEY | clear checkout_dir
@ -44,5 +44,5 @@
- assert:
that:
- git_result | changed
- git_result is changed
when: github_ssh_private_key is defined

View file

@ -10,4 +10,4 @@
- assert:
that:
- git_result | changed
- git_result is changed

View file

@ -30,7 +30,7 @@
- assert:
that:
- git_result | changed
- git_result is changed
- name: SPECIFIC-REVISION | check HEAD after update to revision
command: git rev-parse HEAD
@ -54,7 +54,7 @@
- assert:
that:
- git_result | failed
- git_result is failed
# Same as the previous test, but this time we specify which ref
# contains the SHA1
@ -110,8 +110,8 @@
assert:
that:
- checkout_shallow.rc != 0
- checkout_shallow | success
when: git_version.stdout | version_compare(git_version_supporting_depth, '>=')
- checkout_shallow is successful
when: git_version.stdout is version(git_version_supporting_depth, '>=')
- name: SPECIFIC-REVISION | clear checkout_dir
file: