From e4cac2ac33b9633a1c6663de135baa032bed8808 Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Thu, 1 May 2025 06:46:15 +1000 Subject: [PATCH] Add win_script become tests (#85079) --- test/integration/targets/win_script/tasks/main.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/integration/targets/win_script/tasks/main.yml b/test/integration/targets/win_script/tasks/main.yml index 7c2a152bd37..8374897e107 100644 --- a/test/integration/targets/win_script/tasks/main.yml +++ b/test/integration/targets/win_script/tasks/main.yml @@ -312,6 +312,20 @@ - test_script_result_become.stdout_lines[0]|lower == 'nt authority\\system' - test_script_result_become.stdout_lines[1] == 'finished' +- name: run test script with become set by vars + script: test_script_whoami.ps1 + register: test_script_result_become_vars + vars: + ansible_become: yes + ansible_become_user: SYSTEM + ansible_become_method: runas + +- name: check that the script ran and we get both outputs on new lines + assert: + that: + - test_script_result_become_vars.stdout_lines[0]|lower == 'nt authority\\system' + - test_script_result_become_vars.stdout_lines[1] == 'finished' + - name: run script that emits stderr from sub process script: test_script_with_native_stderr.ps1 register: script_stderr