Change native execution tests to use df instead of stty (#3685)

when automating test execution, some environments don't have a tty which causes
the tests to fail. df is just as good a test as stty as it is also guaranteed to be
present. This change also allows the tests to be run on OSX
This commit is contained in:
James Truher [MSFT] 2017-05-02 18:45:35 -07:00 committed by Mike Richmond
parent 2a739afa9c
commit 563806c15d

View File

@ -1,9 +1,6 @@
if ( $IsWindows ) {
$PesterSkipOrPending = @{ Skip = $true }
}
elseif ( $IsOSX ) {
$PesterSkipOrPending = @{ Pending = $true }
}
else {
$PesterSkipOrPending = @{}
}
@ -27,15 +24,15 @@ Describe "NativeLinuxCommands" -tags "CI" {
}
It "Should not redirect standard input if native command is the first command in pipeline (1)" @PesterSkipOrPending {
stty | ForEach-Object -Begin { $out = @() } -Process { $out += $_ }
df | ForEach-Object -Begin { $out = @() } -Process { $out += $_ }
$out.Length -gt 0 | Should Be $true
$out[0] -like "speed * baud; line =*" | Should Be $true
$out[0] -like "Filesystem*Available*" | Should Be $true
}
It "Should not redirect standard input if native command is the first command in pipeline (2)" @PesterSkipOrPending {
$out = stty
$out = df
$out.Length -gt 0 | Should Be $true
$out[0] -like "speed * baud; line =*" | Should Be $true
$out[0] -like "Filesystem*Available*" | Should Be $true
}
}