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

@ -35,8 +35,8 @@
- "test_script_result.stdout"
- "'Woohoo' in test_script_result.stdout"
- "not test_script_result.stderr"
- "not test_script_result | failed"
- "test_script_result | changed"
- "test_script_result is not failed"
- "test_script_result is changed"
- name: run test script that takes arguments including a unicode char
script: test_script_with_args.ps1 /this /that /Ӧther
@ -51,8 +51,8 @@
- "test_script_with_args_result.stdout_lines[1] == '/that'"
- "test_script_with_args_result.stdout_lines[2] == '/Ӧther'"
- "not test_script_with_args_result.stderr"
- "not test_script_with_args_result | failed"
- "test_script_with_args_result | changed"
- "test_script_with_args_result is not failed"
- "test_script_with_args_result is changed"
- name: run test script that takes parameters passed via splatting
script: test_script_with_splatting.ps1 @{ This = 'this'; That = '{{ test_win_script_value }}'; Other = 'other'}
@ -67,8 +67,8 @@
- "test_script_with_splatting_result.stdout_lines[1] == test_win_script_value"
- "test_script_with_splatting_result.stdout_lines[2] == 'other'"
- "not test_script_with_splatting_result.stderr"
- "not test_script_with_splatting_result | failed"
- "test_script_with_splatting_result | changed"
- "test_script_with_splatting_result is not failed"
- "test_script_with_splatting_result is changed"
- name: run test script that takes splatted parameters from a variable
script: test_script_with_splatting.ps1 {{ test_win_script_splat }}
@ -83,8 +83,8 @@
- "test_script_with_splatting2_result.stdout_lines[1] == 'THAT'"
- "test_script_with_splatting2_result.stdout_lines[2] == 'OTHER'"
- "not test_script_with_splatting2_result.stderr"
- "not test_script_with_splatting2_result | failed"
- "test_script_with_splatting2_result | changed"
- "test_script_with_splatting2_result is not failed"
- "test_script_with_splatting2_result is changed"
- name: run test script that has errors
script: test_script_with_errors.ps1
@ -97,8 +97,8 @@
- "test_script_with_errors_result.rc != 0"
- "not test_script_with_errors_result.stdout"
- "test_script_with_errors_result.stderr"
- "test_script_with_errors_result | failed"
- "test_script_with_errors_result | changed"
- "test_script_with_errors_result is failed"
- "test_script_with_errors_result is changed"
- name: cleanup test file if it exists
raw: Remove-Item "{{ test_win_script_filename }}" -Force
@ -116,8 +116,8 @@
- "test_script_creates_file_result.rc == 0"
- "not test_script_creates_file_result.stdout"
- "not test_script_creates_file_result.stderr"
- "not test_script_creates_file_result | failed"
- "test_script_creates_file_result | changed"
- "test_script_creates_file_result is not failed"
- "test_script_creates_file_result is changed"
- name: run test script that creates a file again
script: test_script_creates_file.ps1 {{ test_win_script_filename }}
@ -128,9 +128,9 @@
- name: check that the script did not run since the remote file exists
assert:
that:
- "not test_script_creates_file_again_result | failed"
- "not test_script_creates_file_again_result | changed"
- "test_script_creates_file_again_result | skipped"
- "test_script_creates_file_again_result is not failed"
- "test_script_creates_file_again_result is not changed"
- "test_script_creates_file_again_result is skipped"
- name: run test script that removes a file
script: test_script_removes_file.ps1 {{ test_win_script_filename }}
@ -144,8 +144,8 @@
- "test_script_removes_file_result.rc == 0"
- "not test_script_removes_file_result.stdout"
- "not test_script_removes_file_result.stderr"
- "not test_script_removes_file_result | failed"
- "test_script_removes_file_result | changed"
- "test_script_removes_file_result is not failed"
- "test_script_removes_file_result is changed"
- name: run test script that removes a file again
script: test_script_removes_file.ps1 {{ test_win_script_filename }}
@ -156,9 +156,9 @@
- name: check that the script did not run since the remote file does not exist
assert:
that:
- "not test_script_removes_file_again_result | failed"
- "not test_script_removes_file_again_result | changed"
- "test_script_removes_file_again_result | skipped"
- "test_script_removes_file_again_result is not failed"
- "test_script_removes_file_again_result is not changed"
- "test_script_removes_file_again_result is skipped"
# TODO: these tests fail on 2008 (not even R2) with no output. It's related to the default codepage being UTF8- if we force it back to 437, it works fine.
# Need to figure out a sane place to do that under the new exec wrapper.
@ -173,8 +173,8 @@
# - "test_batch_result.stdout"
# - "'batch' in test_batch_result.stdout"
# - "not test_batch_result.stderr"
# - "not test_batch_result | failed"
# - "test_batch_result | changed"
# - "test_batch_result is not failed"
# - "test_batch_result is changed"
#- name: run simple batch file with .cmd extension
@ -188,8 +188,8 @@
# - "test_cmd_result.stdout"
# - "'cmd extension' in test_cmd_result.stdout"
# - "not test_cmd_result.stderr"
# - "not test_cmd_result | failed"
# - "test_cmd_result | changed"
# - "test_cmd_result is not failed"
# - "test_cmd_result is changed"
- name: run test script that takes a boolean parameter
script: test_script_bool.ps1 $true
@ -211,7 +211,7 @@
#- name: ensure that script ran and that environment var was passed
# assert:
# that:
# - test_script_env_result | succeeded
# - test_script_env_result is successful
# - test_script_env_result.stdout_lines[0] == 'task'
#
@ -232,7 +232,7 @@
- name: Assert that a change was reported but the script did not make changes
assert:
that:
- test_script_creates_file_check_mode | changed
- test_script_creates_file_check_mode is changed
- not create_file_stat.stat.exists
- name: Run test script that creates a file
@ -255,5 +255,5 @@
- name: Assert that a change was reported but the script did not make changes
assert:
that:
- test_script_removes_file_check_mode | changed
- test_script_removes_file_check_mode is changed
- remove_file_stat.stat.exists