Fix SSH tests

This commit is contained in:
Vivian Thiebaut 2022-11-15 14:25:48 -05:00
parent c5b985c66f
commit 47e734c1fb
2 changed files with 8 additions and 8 deletions

View File

@ -691,7 +691,7 @@ function Invoke-OpenSSHE2ETest
Write-Log -Message "Running OpenSSH E2E tests..." Write-Log -Message "Running OpenSSH E2E tests..."
# $testFolders = @(Get-ChildItem *.tests.ps1 -Recurse | ForEach-Object{ Split-Path $_.FullName} | Sort-Object -Unique) # $testFolders = @(Get-ChildItem *.tests.ps1 -Recurse | ForEach-Object{ Split-Path $_.FullName} | Sort-Object -Unique)
# Invoke-Pester $testFolders -OutputFormat NUnitXml -OutputFile $Script:E2ETestResultsFile -Tag $pri -PassThru # Invoke-Pester $testFolders -OutputFormat NUnitXml -OutputFile $Script:E2ETestResultsFile -Tag $pri -PassThru
Invoke-Pester .\FileBasedLogging.tests.ps1 -OutputFormat NUnitXml -OutputFile $Script:E2ETestResultsFile -Tag $pri -PassThru Invoke-Pester .\SSH.tests.ps1 -OutputFormat NUnitXml -OutputFile $Script:E2ETestResultsFile -Tag $pri -PassThru
Pop-Location Pop-Location
} }

View File

@ -153,7 +153,7 @@ Describe "E2E scenarios for ssh client" -Tags "CI" {
It "$tC.$tI - multiple double quotes in cmdline" { It "$tC.$tI - multiple double quotes in cmdline" {
# actual command line ssh target \"cmd\" /c \"echo hello\" # actual command line ssh target \"cmd\" /c \"echo hello\"
$o = ssh test_target `\`"cmd`\`" /c `\`"echo hello`\`" $o = ssh test_target `"cmd`" /c `"echo hello`"
$o | Should Be "hello" $o | Should Be "hello"
} }
@ -219,19 +219,19 @@ Describe "E2E scenarios for ssh client" -Tags "CI" {
} }
It "$tC.$tI - powershell as default shell and double quotes in cmdline" { It "$tC.$tI - powershell as default shell and double quotes in cmdline" {
# actual command line ssh target echo `"hello`" # actual command line ssh target echo `"hello`"
$o = ssh test_target echo ``\`"hello``\`" $o = ssh test_target echo `"hello`"
$o | Should Be "`"hello`"" $o | Should Be "`"hello`""
} }
It "$tC.$tI - multiple commands with double quotes in powershell cmdlet" -skip:$skip { It "$tC.$tI - multiple commands with double quotes in powershell cmdlet" -skip:$skip {
# actual command line ssh target cd "$env:programfiles";pwd # actual command line ssh target cd "$env:programfiles";pwd
$o = ssh test_target "cd \`"`$env:programfiles\`";pwd" $o = ssh test_target "cd `"`$env:programfiles\`";pwd"
$LASTEXITCODE | Should Be 0 $LASTEXITCODE | Should Be 0
$match = $o -match "Program Files" $match = $o -match "Program Files"
$match.count | Should be 1 $match.count | Should be 1
} }
It "$tC.$tI - multiple commands with double quotes in powershell cmdlet" -skip:$skip { It "$tC.$tI - multiple commands with double quotes in powershell cmdlet" -skip:$skip {
# actual command line ssh target dir "$env:programfiles";cd "$env:programfiles";pwd # actual command line ssh target dir "$env:programfiles";cd "$env:programfiles";pwd
$o = ssh test_target "dir \`"`$env:programfiles\`";cd \`"`$env:programfiles\`";pwd" $o = ssh test_target "dir `"`$env:programfiles\`";cd `"`$env:programfiles\`";pwd"
$LASTEXITCODE | Should Be 0 $LASTEXITCODE | Should Be 0
#$o -contains "Program Files" | Should Be $True #$o -contains "Program Files" | Should Be $True
$match = $o -match "Program Files" $match = $o -match "Program Files"
@ -263,7 +263,7 @@ Describe "E2E scenarios for ssh client" -Tags "CI" {
} }
It "$tC.$tI - cmd as default shell and double quotes in cmdline" { It "$tC.$tI - cmd as default shell and double quotes in cmdline" {
# actual command line ssh target echo "\"hello\"" # actual command line ssh target echo "\"hello\""
$o = ssh test_target 'echo "\"hello\""' $o = ssh test_target echo "`"hello`""
$o | Should Be "`"hello`"" $o | Should Be "`"hello`""
} }
It "$tC.$tI - single quotes in powershell cmdlet" -skip:$skip { It "$tC.$tI - single quotes in powershell cmdlet" -skip:$skip {
@ -286,7 +286,7 @@ Describe "E2E scenarios for ssh client" -Tags "CI" {
} }
It "$tC.$tI - shellhost as default shell and multiple double quotes in cmdline" { It "$tC.$tI - shellhost as default shell and multiple double quotes in cmdline" {
# actual command line ssh target \"cmd\" /c \"echo \"hello\"\" # actual command line ssh target \"cmd\" /c \"echo \"hello\"\"
$o = ssh test_target `\`"cmd`\`" /c `\`"echo \`"hello\`"`\`" $o = ssh test_target `"cmd`" /c `"echo `"hello`"`"
$o | Should Be "`"hello`"" $o | Should Be "`"hello`""
} }
} }
@ -302,7 +302,7 @@ Describe "E2E scenarios for ssh client" -Tags "CI" {
$logFile | Should Contain "OpenSSH_" $logFile | Should Contain "OpenSSH_"
$logFile | Should Contain "Exit Status 0" $logFile | Should Contain "Exit Status 0"
} }
ssh
It "$tC.$tI - cipher options (-c)" { It "$tC.$tI - cipher options (-c)" {
#bad cipher #bad cipher