Fix tests as filters #4 (#33930)

* Resolve newly added tests as filters

* Add code smell to test for ansible provided jinja tests as filters syntax

* Add docs for no-tests-as-filters code smell test

* Address tests as filters in new integration tests

* Address feedback

* Address feedback 2
This commit is contained in:
Matt Martz
2017-12-21 13:42:53 -06:00
committed by GitHub
parent 2616f9d713
commit 57575d1cfa
6 changed files with 121 additions and 21 deletions

View File

@@ -87,7 +87,7 @@
- assert: *false
when: not (platform | match('N35')) and not titanium
when: not ( platform is match('N35')) and not titanium
rescue:

View File

@@ -83,7 +83,7 @@
- name: ensure host system is present
assert:
that:
- add_host_result | changed
- add_host_result is changed
- "{% for host in host_list.json if ((host | basename) == 'test_host_system_0001') -%} True {%- else -%} False {%- endfor %}"
# Testcase: Add Host again
@@ -104,7 +104,7 @@
- name: ensure precend task didn't changed anything
assert:
that:
- not (readd_host_result|changed)
- not ( readd_host_result is changed)
# Testcase: Add Host via add_or_reconnect state
- name: add host via add_or_reconnect
@@ -129,7 +129,7 @@
- name: ensure host system is present
assert:
that:
- add_or_reconnect_host_result | changed
- add_or_reconnect_host_result is changed
- "{% for host in host_list.json if ((host | basename) == 'test_host_system_0002') -%} True {%- else -%} False {%- endfor %}"
## Testcase: Reconnect Host
@@ -152,7 +152,7 @@
#- name: ensure host system has been reconnected
# assert:
# that:
# - reconnect_host_result | changed
# - reconnect_host_result is changed
# # it would be a good idea to check the events on the host to see the reconnect
# # https://github.com/vmware/govmomi/blob/master/govc/USAGE.md#events
# # "govc events ..." need to be callable from
@@ -183,7 +183,7 @@
#- name: ensure host system is absent
# assert:
# that:
# - remove_host_result | changed
# - remove_host_result is changed
# - "{% for host in host_list.json if ((host | basename) == 'test_host_system_0001') -%} False {%- else -%} True {%- endfor %}"
## Testcase: Remove Host again
@@ -206,4 +206,4 @@
#- name: ensure precend task didn't changed anything
# assert:
# that:
# - not (reremove_host_result|changed)
# - not ( reremove_host_result is changed)

View File

@@ -6,7 +6,7 @@
ignore_errors: true
- name: Only run tests when Windows is capable
when: (win_feature_has_storage_module|success) and (ansible_powershell_version is defined) and (ansible_powershell_version >= 3)
when: ( win_feature_has_storage_module is successful) and (ansible_powershell_version is defined) and (ansible_powershell_version >= 3)
block:
- name: Test in normal mode