summaryrefslogtreecommitdiffstats
path: root/test/integration
diff options
context:
space:
mode:
authorJordan Borean <jborean93@gmail.com>2017-10-23 01:50:19 +0200
committerGitHub <noreply@github.com>2017-10-23 01:50:19 +0200
commit8e44cd5d101ec7f66c0792c2dee6d97809e90752 (patch)
treefa3b1f69bf4bee7eebeb96729082dc86584387ee /test/integration
parentwindows argv to string module utility (#28970) (diff)
downloadansible-8e44cd5d101ec7f66c0792c2dee6d97809e90752.tar.xz
ansible-8e44cd5d101ec7f66c0792c2dee6d97809e90752.zip
win_command win_shell: add stdin option (#31619)
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/targets/win_command/tasks/main.yml15
-rw-r--r--test/integration/targets/win_shell/tasks/main.yml14
2 files changed, 29 insertions, 0 deletions
diff --git a/test/integration/targets/win_command/tasks/main.yml b/test/integration/targets/win_command/tasks/main.yml
index b49d19301d..aaa8ea3fb9 100644
--- a/test/integration/targets/win_command/tasks/main.yml
+++ b/test/integration/targets/win_command/tasks/main.yml
@@ -178,3 +178,18 @@
win_file:
path: C:\ansible testing
state: absent
+
+- name: run stdin test
+ win_command: powershell.exe -
+ args:
+ stdin: Write-Host "some input"
+ register: cmdout
+
+- name: assert run stdin test
+ assert:
+ that:
+ - cmdout|changed
+ - cmdout.rc == 0
+ - cmdout.stdout_lines|count == 1
+ - cmdout.stdout_lines[0] == "some input"
+ - cmdout.stderr == ""
diff --git a/test/integration/targets/win_shell/tasks/main.yml b/test/integration/targets/win_shell/tasks/main.yml
index 89d011d8bd..2716b948e3 100644
--- a/test/integration/targets/win_shell/tasks/main.yml
+++ b/test/integration/targets/win_shell/tasks/main.yml
@@ -188,3 +188,17 @@
- shellout.stdout is search("doneout")
- shellout.stderr is search("starterror")
- shellout.stderr is search("doneerror")
+
+- name: run stdin test
+ win_shell: '$string = [Console]::In.ReadToEnd(); Write-Output $string.Trim()'
+ args:
+ stdin: some input
+ register: shellout
+
+- name: assert run stdin test
+ assert:
+ that:
+ - shellout|changed
+ - shellout.rc == 0
+ - shellout.stderr == ""
+ - shellout.stdout == "some input\r\n"