From 9985b8a9756c570811d0f221bc11ffc9354f291f Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Thu, 11 Nov 2021 11:04:39 +1000 Subject: ansible-test pssa update and new rules (#76256) --- .../targets/win_async_wrapper/library/async_test.ps1 | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'test/integration/targets/win_async_wrapper') diff --git a/test/integration/targets/win_async_wrapper/library/async_test.ps1 b/test/integration/targets/win_async_wrapper/library/async_test.ps1 index fa41b3e824..3b4c1c85f3 100644 --- a/test/integration/targets/win_async_wrapper/library/async_test.ps1 +++ b/test/integration/targets/win_async_wrapper/library/async_test.ps1 @@ -7,9 +7,9 @@ $parsed_args = Parse-Args $args $sleep_delay_sec = Get-AnsibleParam -obj $parsed_args -name "sleep_delay_sec" -type "int" -default 0 -$fail_mode = Get-AnsibleParam -obj $parsed_args -name "fail_mode" -type "str" -default "success" -validateset "success","graceful","exception" +$fail_mode = Get-AnsibleParam -obj $parsed_args -name "fail_mode" -type "str" -default "success" -validateset "success", "graceful", "exception" -If($fail_mode -isnot [array]) { +If ($fail_mode -isnot [array]) { $fail_mode = @($fail_mode) } @@ -19,30 +19,29 @@ $result = @{ module_tempdir = $PSScriptRoot } -If($sleep_delay_sec -gt 0) { +If ($sleep_delay_sec -gt 0) { Sleep -Seconds $sleep_delay_sec $result["slept_sec"] = $sleep_delay_sec } -If($fail_mode -contains "leading_junk") { +If ($fail_mode -contains "leading_junk") { Write-Output "leading junk before module output" } -If($fail_mode -contains "graceful") { +If ($fail_mode -contains "graceful") { Fail-Json $result "failed gracefully" } Try { - If($fail_mode -contains "exception") { + If ($fail_mode -contains "exception") { Throw "failing via exception" } Exit-Json $result } -Finally -{ - If($fail_mode -contains "trailing_junk") { +Finally { + If ($fail_mode -contains "trailing_junk") { Write-Output "trailing junk after module output" } } -- cgit v1.2.3