mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-09 18:51:29 -07:00
win_script: work when argument exceeds stdin buffer size (#33855)
* win_script: work when argument exceeds stdin buffer size * Added test for large argument being passed
This commit is contained in:
parent
e6d01ff7e3
commit
f0134079e3
3 changed files with 46 additions and 24 deletions
|
@ -54,6 +54,24 @@
|
|||
- "test_script_with_args_result is not failed"
|
||||
- "test_script_with_args_result is changed"
|
||||
|
||||
# Bug: https://github.com/ansible/ansible/issues/32850
|
||||
- name: set fact of long string
|
||||
set_fact:
|
||||
long_string: "{{ lookup('pipe', 'printf \"a%.0s\" {1..1000}') }}"
|
||||
|
||||
- name: run test script with args that exceed the stdin buffer
|
||||
script: test_script_with_args.ps1 {{ long_string }}
|
||||
register: test_script_with_large_args_result
|
||||
|
||||
- name: check that script ran and received arguments correctly
|
||||
assert:
|
||||
that:
|
||||
- test_script_with_large_args_result.rc == 0
|
||||
- test_script_with_large_args_result.stdout == long_string + "\r\n"
|
||||
- not test_script_with_large_args_result.stderr
|
||||
- test_script_with_large_args_result is not failed
|
||||
- test_script_with_large_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'}
|
||||
register: test_script_with_splatting_result
|
||||
|
@ -201,20 +219,17 @@
|
|||
- "test_script_bool_result.stdout_lines[0] == 'System.Boolean'"
|
||||
- "test_script_bool_result.stdout_lines[1] == 'True'"
|
||||
|
||||
# FIXME: re-enable this test once script can run under the wrapper with powershell
|
||||
#- name: run test script that uses envvars
|
||||
# script: test_script_with_env.ps1
|
||||
# environment:
|
||||
# taskenv: task
|
||||
# register: test_script_env_result
|
||||
#
|
||||
#- name: ensure that script ran and that environment var was passed
|
||||
# assert:
|
||||
# that:
|
||||
# - test_script_env_result is successful
|
||||
# - test_script_env_result.stdout_lines[0] == 'task'
|
||||
#
|
||||
- name: run test script that uses envvars
|
||||
script: test_script_with_env.ps1
|
||||
environment:
|
||||
taskenv: task
|
||||
register: test_script_env_result
|
||||
|
||||
- name: ensure that script ran and that environment var was passed
|
||||
assert:
|
||||
that:
|
||||
- test_script_env_result is successful
|
||||
- test_script_env_result.stdout_lines[0] == 'task'
|
||||
|
||||
# check mode
|
||||
- name: Run test script that creates a file in check mode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue