fix win_shell/win_command nonzero RC failure setting (#26443)
* as a result of recent core engine changes to ignore rc, modules are responsible to set `failed` on nonzero RC if they want that behavior * the `failed` filter currently triggers on nonzero RC, which caused the tests to false-pass * updated tests to explicitly check both rc and failed keys, as well as using the failed filter.
This commit is contained in:
parent
1d62283796
commit
08af853ee9
4 changed files with 11 additions and 0 deletions
|
@ -159,6 +159,10 @@ $proc.WaitForExit() | Out-Null
|
||||||
|
|
||||||
$result.rc = $proc.ExitCode
|
$result.rc = $proc.ExitCode
|
||||||
|
|
||||||
|
If ($result.rc -ne 0) {
|
||||||
|
$result.failed = $true
|
||||||
|
}
|
||||||
|
|
||||||
$end_datetime = [DateTime]::UtcNow
|
$end_datetime = [DateTime]::UtcNow
|
||||||
|
|
||||||
$result.start = $start_datetime.ToString("yyyy-MM-dd hh:mm:ss.ffffff")
|
$result.start = $start_datetime.ToString("yyyy-MM-dd hh:mm:ss.ffffff")
|
||||||
|
|
|
@ -168,6 +168,10 @@ $proc.WaitForExit() | Out-Null
|
||||||
|
|
||||||
$result.rc = $proc.ExitCode
|
$result.rc = $proc.ExitCode
|
||||||
|
|
||||||
|
If ($result.rc -ne 0) {
|
||||||
|
$result.failed = $true
|
||||||
|
}
|
||||||
|
|
||||||
$end_datetime = [DateTime]::UtcNow
|
$end_datetime = [DateTime]::UtcNow
|
||||||
|
|
||||||
$result.start = $start_datetime.ToString("yyyy-MM-dd hh:mm:ss.ffffff")
|
$result.start = $start_datetime.ToString("yyyy-MM-dd hh:mm:ss.ffffff")
|
||||||
|
|
|
@ -120,6 +120,7 @@
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- cmdout|failed
|
- cmdout|failed
|
||||||
|
- cmdout.failed == True # check the failure key explicitly, since failed does magic with RC
|
||||||
- cmdout.rc == 254
|
- cmdout.rc == 254
|
||||||
|
|
||||||
- name: interleave large writes between stdout/stderr (check for buffer consumption deadlock)
|
- name: interleave large writes between stdout/stderr (check for buffer consumption deadlock)
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- shellout|failed
|
- shellout|failed
|
||||||
|
- shellout.failed == true # check the failure key explicitly, since failed does magic with RC
|
||||||
- shellout|changed
|
- shellout|changed
|
||||||
- shellout.cmd == 'bogus_command1234'
|
- shellout.cmd == 'bogus_command1234'
|
||||||
- shellout.delta is match('^\d:(\d){2}:(\d){2}.(\d){6}$')
|
- shellout.delta is match('^\d:(\d){2}:(\d){2}.(\d){6}$')
|
||||||
|
@ -147,6 +148,7 @@
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- shellout|failed
|
- shellout|failed
|
||||||
|
- shellout.failed == True # check the failure key explicitly, since failed does magic with RC
|
||||||
- shellout.rc == 254
|
- shellout.rc == 254
|
||||||
|
|
||||||
- name: run something via cmd that will fail in powershell
|
- name: run something via cmd that will fail in powershell
|
||||||
|
|
Loading…
Reference in a new issue