From 3c19f2aa0e23f84c28972aed45a8e769c7a760c2 Mon Sep 17 00:00:00 2001 From: Vivian Thiebaut Date: Mon, 14 Nov 2022 16:50:56 -0500 Subject: [PATCH 1/8] Change the way current platform is checked to use True automatic variable --- .../Authorized_keys_fileperm.Tests.ps1 | 6 ++-- regress/pesterTests/CommonUtils.psm1 | 34 ++----------------- .../pesterTests/FileBasedLogging.tests.ps1 | 4 +-- .../pesterTests/Hostkey_fileperm.Tests.ps1 | 7 ++-- regress/pesterTests/Log_fileperm.Tests.ps1 | 5 ++- .../pesterTests/PlatformAbstractLayer.psm1 | 17 +--------- regress/pesterTests/PortForwarding.Tests.ps1 | 3 +- regress/pesterTests/SCP.Tests.ps1 | 2 +- regress/pesterTests/SFTP.Tests.ps1 | 3 +- regress/pesterTests/SSH.Tests.ps1 | 3 +- regress/pesterTests/SSHDConfig.tests.ps1 | 4 +-- 11 files changed, 19 insertions(+), 69 deletions(-) diff --git a/regress/pesterTests/Authorized_keys_fileperm.Tests.ps1 b/regress/pesterTests/Authorized_keys_fileperm.Tests.ps1 index f129d3516..098957bf0 100644 --- a/regress/pesterTests/Authorized_keys_fileperm.Tests.ps1 +++ b/regress/pesterTests/Authorized_keys_fileperm.Tests.ps1 @@ -32,8 +32,7 @@ Describe "Tests for authorized_keys file permission" -Tags "CI" { #skip when the task schedular (*-ScheduledTask) cmdlets does not exist $ts = (get-command get-ScheduledTask -ErrorAction SilentlyContinue) $skip = $ts -eq $null - $platform = Get-Platform - if(($platform -eq [PlatformType]::Windows) -and ([Environment]::OSVersion.Version.Major -le 6)) + if($IsWindows -and ([Environment]::OSVersion.Version.Major -le 6)) { #suppress the firewall blocking dialogue on win7 netsh advfirewall firewall add rule name="sshd" program="$($OpenSSHTestInfo['OpenSSHBinPath'])\sshd.exe" protocol=any action=allow dir=in @@ -43,8 +42,7 @@ Describe "Tests for authorized_keys file permission" -Tags "CI" { AfterEach { $tI++ } AfterAll { - $platform = Get-Platform - if(($platform -eq [PlatformType]::Windows) -and ($psversiontable.BuildVersion.Major -le 6)) + if($IsWindows -and ($psversiontable.BuildVersion.Major -le 6)) { netsh advfirewall firewall delete rule name="sshd" program="$($OpenSSHTestInfo['OpenSSHBinPath'])\sshd.exe" protocol=any dir=in } diff --git a/regress/pesterTests/CommonUtils.psm1 b/regress/pesterTests/CommonUtils.psm1 index eff6779d3..109dc5543 100644 --- a/regress/pesterTests/CommonUtils.psm1 +++ b/regress/pesterTests/CommonUtils.psm1 @@ -9,33 +9,6 @@ Add-Type -TypeDefinition @" } "@ -function Get-Platform { - # Use the .NET Core APIs to determine the current platform; if a runtime - # exception is thrown, we are on FullCLR, not .NET Core. - try { - $Runtime = [System.Runtime.InteropServices.RuntimeInformation] - $OSPlatform = [System.Runtime.InteropServices.OSPlatform] - - $IsLinux = $Runtime::IsOSPlatform($OSPlatform::Linux) - $IsOSX = $Runtime::IsOSPlatform($OSPlatform::OSX) - $IsWindows = $Runtime::IsOSPlatform($OSPlatform::Windows) - } catch { - try { - $IsLinux = $false - $IsOSX = $false - $IsWindows = $true - } - catch { } - } - if($IsOSX) { - [PlatformType]::OSX - } elseif($IsLinux) { - [PlatformType]::Linux - } else { - [PlatformType]::Windows - } -} - function Set-FilePermission { param( @@ -94,8 +67,7 @@ function Set-FilePermission function Add-PasswordSetting { param([string] $pass) - $platform = Get-Platform - if ($platform -eq [PlatformType]::Windows) { + if ($IsWindows) { if (-not($env:DISPLAY)) {$env:DISPLAY = 1} $askpass_util = Join-Path $PSScriptRoot "utilities\askpass_util\askpass_util.exe" $env:SSH_ASKPASS=$askpass_util @@ -157,8 +129,8 @@ function Stop-SSHDTestDaemon { foreach ($ps in $p) { $pss =$ps.ToString() -split "\s+"; - $pid = $pss[$pss.length -1] - Stop-Process -Id $pid -Force -ErrorAction SilentlyContinue + $processid = $pss[$pss.length -1] + Stop-Process -Id $processid -Force -ErrorAction SilentlyContinue } #if still running, wait a little while for task to complete $num = 0 diff --git a/regress/pesterTests/FileBasedLogging.tests.ps1 b/regress/pesterTests/FileBasedLogging.tests.ps1 index dd065af07..aba0c938c 100644 --- a/regress/pesterTests/FileBasedLogging.tests.ps1 +++ b/regress/pesterTests/FileBasedLogging.tests.ps1 @@ -48,7 +48,7 @@ Describe "Tests for admin and non-admin file based logs" -Tags "CI" { { Stop-SSHDTestDaemon -Port $port } - if(($platform -eq [PlatformType]::Windows) -and ([Environment]::OSVersion.Version.Major -le 6)) + if($IsWindows -and ([Environment]::OSVersion.Version.Major -le 6)) { #suppress the firewall blocking dialogue on win7 netsh advfirewall firewall add rule name="sshd" program="$($OpenSSHTestInfo['OpenSSHBinPath'])\sshd.exe" protocol=any action=allow dir=in @@ -58,7 +58,7 @@ Describe "Tests for admin and non-admin file based logs" -Tags "CI" { AfterEach { $tI++ } AfterAll { - if(($platform -eq [PlatformType]::Windows) -and ($psversiontable.BuildVersion.Major -le 6)) + if($IsWindows -and ($psversiontable.BuildVersion.Major -le 6)) { netsh advfirewall firewall delete rule name="sshd" program="$($OpenSSHTestInfo['OpenSSHBinPath'])\sshd.exe" protocol=any dir=in } diff --git a/regress/pesterTests/Hostkey_fileperm.Tests.ps1 b/regress/pesterTests/Hostkey_fileperm.Tests.ps1 index eb0e9fb34..a6408829e 100644 --- a/regress/pesterTests/Hostkey_fileperm.Tests.ps1 +++ b/regress/pesterTests/Hostkey_fileperm.Tests.ps1 @@ -21,9 +21,8 @@ Describe "Tests for host keys file permission" -Tags "CI" { $ssouser = $OpenSSHTestInfo["SSOUser"] $script:logNum = 0 Remove-Item -Path (Join-Path $testDir "*$logName") -Force -ErrorAction SilentlyContinue - $platform = Get-Platform - $skip = ($platform -eq [PlatformType]::Windows) -and ([Environment]::OSVersion.Version.Major -le 6) -and ([Environment]::OSVersion.Version.Minor -lt 2) - if(($platform -eq [PlatformType]::Windows) -and ($psversiontable.BuildVersion.Major -le 6)) + $skip = $IsWindows -and ([Environment]::OSVersion.Version.Major -le 6) -and ([Environment]::OSVersion.Version.Minor -lt 2) + if($IsWindows -and ($psversiontable.BuildVersion.Major -le 6)) { #suppress the firewall blocking dialogue on win7 netsh advfirewall firewall add rule name="sshd" program="$($OpenSSHTestInfo['OpenSSHBinPath'])\sshd.exe" protocol=any action=allow dir=in @@ -32,7 +31,7 @@ Describe "Tests for host keys file permission" -Tags "CI" { AfterEach { $tI++ } AfterAll { - if(($platform -eq [PlatformType]::Windows) -and ($psversiontable.BuildVersion.Major -le 6)) + if($IsWindows -and ($psversiontable.BuildVersion.Major -le 6)) { netsh advfirewall firewall delete rule name="sshd" program="$($OpenSSHTestInfo['OpenSSHBinPath'])\sshd.exe" protocol=any dir=in } diff --git a/regress/pesterTests/Log_fileperm.Tests.ps1 b/regress/pesterTests/Log_fileperm.Tests.ps1 index 2edce87fa..1c00f200a 100644 --- a/regress/pesterTests/Log_fileperm.Tests.ps1 +++ b/regress/pesterTests/Log_fileperm.Tests.ps1 @@ -25,8 +25,7 @@ Describe "Tests for log file permission" -Tags "CI" { Remove-Item (Join-Path $testDir "*$logName") -Force -ErrorAction SilentlyContinue - $platform = Get-Platform - if(($platform -eq [PlatformType]::Windows) -and ($psversiontable.BuildVersion.Major -le 6)) + if($IsWindows -and ($psversiontable.BuildVersion.Major -le 6)) { #suppress the firewall blocking dialogue on win7 netsh advfirewall firewall add rule name="sshd" program="$($OpenSSHTestInfo['OpenSSHBinPath'])\sshd.exe" protocol=any action=allow dir=in @@ -84,7 +83,7 @@ Describe "Tests for log file permission" -Tags "CI" { AfterEach {$tI++;} AfterAll { - if(($platform -eq [PlatformType]::Windows) -and ($psversiontable.BuildVersion.Major -le 6)) + if($IsWindows -and ($psversiontable.BuildVersion.Major -le 6)) { netsh advfirewall firewall delete rule name="sshd" program="$($OpenSSHTestInfo['OpenSSHBinPath'])\sshd.exe" protocol=any dir=in } diff --git a/regress/pesterTests/PlatformAbstractLayer.psm1 b/regress/pesterTests/PlatformAbstractLayer.psm1 index a340d1653..5ea304d70 100644 --- a/regress/pesterTests/PlatformAbstractLayer.psm1 +++ b/regress/pesterTests/PlatformAbstractLayer.psm1 @@ -19,26 +19,11 @@ Enum PlatformType { function Set-Platform { # Use the .NET Core APIs to determine the current platform; if a runtime # exception is thrown, we are on FullCLR, not .NET Core. - try { - $Runtime = [System.Runtime.InteropServices.RuntimeInformation] - $OSPlatform = [System.Runtime.InteropServices.OSPlatform] - - $IsLinux = $Runtime::IsOSPlatform($OSPlatform::Linux) - $IsOSX = $Runtime::IsOSPlatform($OSPlatform::OSX) - $IsWindows = $Runtime::IsOSPlatform($OSPlatform::Windows) - } catch { - try { - $IsLinux = $false - $IsOSX = $false - $IsWindows = $true - } - catch { } - } if($IsOSX) { [PlatformType]::OSX } elseif($IsLinux) { [PlatformType]::Linux - } else { + } elseif($IsWindows) { [PlatformType]::Windows } } diff --git a/regress/pesterTests/PortForwarding.Tests.ps1 b/regress/pesterTests/PortForwarding.Tests.ps1 index 68f38d2f2..0fe4b5269 100644 --- a/regress/pesterTests/PortForwarding.Tests.ps1 +++ b/regress/pesterTests/PortForwarding.Tests.ps1 @@ -15,9 +15,8 @@ Describe "E2E scenarios for port forwarding" -Tags "CI" { { $null = New-Item $testDir -ItemType directory -Force -ErrorAction SilentlyContinue } - $platform = Get-Platform #skip on ps 2 becase non-interactive cmd require a ENTER before it returns on ps2 - $skip = ($platform -eq [PlatformType]::Windows) -and ($PSVersionTable.PSVersion.Major -le 2) + $skip = $IsWindows -and ($PSVersionTable.PSVersion.Major -le 2) } BeforeEach { diff --git a/regress/pesterTests/SCP.Tests.ps1 b/regress/pesterTests/SCP.Tests.ps1 index 54623c5a1..3648ac73d 100644 --- a/regress/pesterTests/SCP.Tests.ps1 +++ b/regress/pesterTests/SCP.Tests.ps1 @@ -206,7 +206,7 @@ Describe "Tests for scp command" -Tags "CI" { $equal = @(Compare-Object (Get-ChildItem -Recurse -path $SourceDir) (Get-ChildItem -Recurse -path (join-path $DestinationDir $SourceDirName) ) -Property Name, Length).Length -eq 0 $equal | Should Be $true - if($Options.contains("-p ") -and ($platform -eq [PlatformType]::Windows) -and ($PSVersionTable.PSVersion.Major -gt 2)) + if($Options.contains("-p ") -and $IsWindows -and ($PSVersionTable.PSVersion.Major -gt 2)) { $equal = @(Compare-Object (Get-ChildItem -Recurse -path $SourceDir).LastWriteTime.DateTime (Get-ChildItem -Recurse -path (join-path $DestinationDir $SourceDirName) ).LastWriteTime.DateTime).Length -eq 0 $equal | Should Be $true diff --git a/regress/pesterTests/SFTP.Tests.ps1 b/regress/pesterTests/SFTP.Tests.ps1 index 8d8957e7b..a0a35f380 100644 --- a/regress/pesterTests/SFTP.Tests.ps1 +++ b/regress/pesterTests/SFTP.Tests.ps1 @@ -36,8 +36,7 @@ Describe "SFTP Test Cases" -Tags "CI" { Remove-item (Join-Path $rootDirectory "*.$batchFileName") -Force -ErrorAction SilentlyContinue Remove-item (Join-Path $rootDirectory "*.log") -Force -ErrorAction SilentlyContinue - $platform = Get-Platform - $skip = ($platform -eq [PlatformType]::Windows) -and ($PSVersionTable.PSVersion.Major -le 2) + $skip = $IsWindows -and ($PSVersionTable.PSVersion.Major -le 2) $testData1 = @( @{ diff --git a/regress/pesterTests/SSH.Tests.ps1 b/regress/pesterTests/SSH.Tests.ps1 index 618a925b2..f6ce8f9db 100644 --- a/regress/pesterTests/SSH.Tests.ps1 +++ b/regress/pesterTests/SSH.Tests.ps1 @@ -27,9 +27,8 @@ Describe "E2E scenarios for ssh client" -Tags "CI" { $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($ssouser, $rights, "ContainerInherit,Objectinherit", "None", "Allow") $acl.SetAccessRule($accessRule) Set-Acl -Path $testDir -AclObject $acl - $platform = Get-Platform #skip on ps 2 becase non-interactive cmd require a ENTER before it returns on ps2 - $skip = ($platform -eq [PlatformType]::Windows) -and ($PSVersionTable.PSVersion.Major -le 2) + $skip = $IsWindows -and ($PSVersionTable.PSVersion.Major -le 2) <#$testData = @( @{ diff --git a/regress/pesterTests/SSHDConfig.tests.ps1 b/regress/pesterTests/SSHDConfig.tests.ps1 index be1e2542f..47a825959 100644 --- a/regress/pesterTests/SSHDConfig.tests.ps1 +++ b/regress/pesterTests/SSHDConfig.tests.ps1 @@ -142,7 +142,7 @@ Match User matchuser { Stop-SSHDTestDaemon -Port $port } - if(($platform -eq [PlatformType]::Windows) -and ([Environment]::OSVersion.Version.Major -le 6)) + if($IsWindows -and ([Environment]::OSVersion.Version.Major -le 6)) { #suppress the firewall blocking dialogue on win7 netsh advfirewall firewall add rule name="sshd" program="$($OpenSSHTestInfo['OpenSSHBinPath'])\sshd.exe" protocol=any action=allow dir=in @@ -153,7 +153,7 @@ Match User matchuser AfterAll { $PrincipalContext.Dispose() - if(($platform -eq [PlatformType]::Windows) -and ($psversiontable.BuildVersion.Major -le 6)) + if($IsWindows -and ($psversiontable.BuildVersion.Major -le 6)) { netsh advfirewall firewall delete rule name="sshd" program="$($OpenSSHTestInfo['OpenSSHBinPath'])\sshd.exe" protocol=any dir=in } From c5b985c66f25c6c256a597c6fa0af08e3fd76763 Mon Sep 17 00:00:00 2001 From: Vivian Thiebaut Date: Tue, 15 Nov 2022 11:16:14 -0500 Subject: [PATCH 2/8] Only run the failing tests --- .../AzDOBuildTools/AzDOBuildTools.psm1 | 124 +++++++++--------- contrib/win32/openssh/OpenSSHTestHelper.psm1 | 5 +- .../pesterTests/FileBasedLogging.tests.ps1 | 4 +- 3 files changed, 67 insertions(+), 66 deletions(-) diff --git a/contrib/win32/openssh/AzDOBuildTools/AzDOBuildTools.psm1 b/contrib/win32/openssh/AzDOBuildTools/AzDOBuildTools.psm1 index 9293a3475..85402bc80 100644 --- a/contrib/win32/openssh/AzDOBuildTools/AzDOBuildTools.psm1 +++ b/contrib/win32/openssh/AzDOBuildTools/AzDOBuildTools.psm1 @@ -200,20 +200,20 @@ function Invoke-OpenSSHTests # ... # FixHostFilePermissions.ps1 # ... - Write-Verbose -Verbose -Message "Running Unit Tests..." - Write-Verbose -Verbose -Message "Unit test directory is: ${OpenSSHBinPath}" + # Write-Verbose -Verbose -Message "Running Unit Tests..." + # Write-Verbose -Verbose -Message "Unit test directory is: ${OpenSSHBinPath}" - $unitTestFailed = Invoke-OpenSSHUnitTest -UnitTestDirectory $OpenSSHBinPath + # $unitTestFailed = Invoke-OpenSSHUnitTest -UnitTestDirectory $OpenSSHBinPath - if($unitTestFailed) - { - Write-BuildMessage "At least one of the unit tests failed!" -Category Error - $AllTestsPassed = $false - } - else - { - Write-BuildMessage -Message "All Unit tests passed!" -Category Information - } + # if($unitTestFailed) + # { + # Write-BuildMessage "At least one of the unit tests failed!" -Category Error + # $AllTestsPassed = $false + # } + # else + # { + # Write-BuildMessage -Message "All Unit tests passed!" -Category Information + # } # Run all E2E tests. Write-Verbose -Verbose -Message "Running E2E Tests..." @@ -239,62 +239,62 @@ function Invoke-OpenSSHTests } } - # Bash tests. - Write-Verbose -Verbose -Message "Running Bash Tests..." + # # Bash tests. + # Write-Verbose -Verbose -Message "Running Bash Tests..." - # Ensure CygWin is installed, and install from Chocolatey if needed. - $cygwinInstalled = $true - $cygwinInstallLocation = "$env:SystemDrive/cygwin" - if (! (Test-Path -Path "$cygwinInstallLocation/bin/sh.exe")) - { - Write-Verbose -Verbose -Message "CygWin not found" - Install-CygWin -InstallLocation $cygwinInstallLocation + # # Ensure CygWin is installed, and install from Chocolatey if needed. + # $cygwinInstalled = $true + # $cygwinInstallLocation = "$env:SystemDrive/cygwin" + # if (! (Test-Path -Path "$cygwinInstallLocation/bin/sh.exe")) + # { + # Write-Verbose -Verbose -Message "CygWin not found" + # Install-CygWin -InstallLocation $cygwinInstallLocation - # Hack to fix up mangled CygWin directory, if needed. - $expectedCygWinPath = "$env:SystemDrive/cygwin/bin/sh.exe" - if (! (Test-Path -Path $expectedCygWinPath)) - { - Write-Verbose -Verbose -Message "CygWin did not install correctly, missing expected path: ${expectedCygWinPath}" + # # Hack to fix up mangled CygWin directory, if needed. + # $expectedCygWinPath = "$env:SystemDrive/cygwin/bin/sh.exe" + # if (! (Test-Path -Path $expectedCygWinPath)) + # { + # Write-Verbose -Verbose -Message "CygWin did not install correctly, missing expected path: ${expectedCygWinPath}" - $cygWinDirs = Get-Item -Path "$env:SystemDrive/cygwin*" - if ($cygWinDirs.Count -gt 1) - { - Write-Verbose -Verbose -Message "CygWin install failed with mangled folder locations: ${cygWinDirs}" - Write-Verbose -Verbose -Message 'TODO: Add hack to fix up CygWin folder.' - } + # $cygWinDirs = Get-Item -Path "$env:SystemDrive/cygwin*" + # if ($cygWinDirs.Count -gt 1) + # { + # Write-Verbose -Verbose -Message "CygWin install failed with mangled folder locations: ${cygWinDirs}" + # Write-Verbose -Verbose -Message 'TODO: Add hack to fix up CygWin folder.' + # } - Write-BuildMessage -Message "All bash tests failed because CygWin install failed" -Category Error - $AllTestsPassed = $false - $cygwinInstalled = $false - } - } + # Write-BuildMessage -Message "All bash tests failed because CygWin install failed" -Category Error + # $AllTestsPassed = $false + # $cygwinInstalled = $false + # } + # } - # Run UNIX bash tests. - if ($cygwinInstalled) - { - Write-Verbose -Verbose -Message "Starting Bash Tests..." - Invoke-OpenSSHBashTests - if (-not $Global:bash_tests_summary) - { - $errorMessage = "Failed to start OpenSSH bash tests" - Write-BuildMessage -Message $errorMessage -Category Error - $AllTestsPassed = $false - } - else - { - if ($Global:bash_tests_summary["TotalBashTestsFailed"] -ne 0) - { - $total_bash_failed_tests = $Global:bash_tests_summary["TotalBashTestsFailed"] - $total_bash_tests = $Global:bash_tests_summary["TotalBashTests"] - $errorMessage = "At least one of the bash tests failed. [$total_bash_failed_tests of $total_bash_tests]" - Write-BuildMessage -Message $errorMessage -Category Error - $AllTestsPassed = $false - } + # # Run UNIX bash tests. + # if ($cygwinInstalled) + # { + # Write-Verbose -Verbose -Message "Starting Bash Tests..." + # Invoke-OpenSSHBashTests + # if (-not $Global:bash_tests_summary) + # { + # $errorMessage = "Failed to start OpenSSH bash tests" + # Write-BuildMessage -Message $errorMessage -Category Error + # $AllTestsPassed = $false + # } + # else + # { + # if ($Global:bash_tests_summary["TotalBashTestsFailed"] -ne 0) + # { + # $total_bash_failed_tests = $Global:bash_tests_summary["TotalBashTestsFailed"] + # $total_bash_tests = $Global:bash_tests_summary["TotalBashTests"] + # $errorMessage = "At least one of the bash tests failed. [$total_bash_failed_tests of $total_bash_tests]" + # Write-BuildMessage -Message $errorMessage -Category Error + # $AllTestsPassed = $false + # } - $OpenSSHTestInfo["BashTestSummaryFile"] = $Global:bash_tests_summary["BashTestSummaryFile"] - $OpenSSHTestInfo["BashTestLogFile"] = $Global:bash_tests_summary["BashTestLogFile"] - } - } + # $OpenSSHTestInfo["BashTestSummaryFile"] = $Global:bash_tests_summary["BashTestSummaryFile"] + # $OpenSSHTestInfo["BashTestLogFile"] = $Global:bash_tests_summary["BashTestLogFile"] + # } + # } # OpenSSH Uninstall Tests Invoke-OpenSSHUninstallTest diff --git a/contrib/win32/openssh/OpenSSHTestHelper.psm1 b/contrib/win32/openssh/OpenSSHTestHelper.psm1 index 2d5b2118d..eaf9ef4d5 100644 --- a/contrib/win32/openssh/OpenSSHTestHelper.psm1 +++ b/contrib/win32/openssh/OpenSSHTestHelper.psm1 @@ -689,8 +689,9 @@ function Invoke-OpenSSHE2ETest # Discover all CI tests and run them. Push-Location $Script:E2ETestDirectory Write-Log -Message "Running OpenSSH E2E tests..." - $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 + # $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 .\FileBasedLogging.tests.ps1 -OutputFormat NUnitXml -OutputFile $Script:E2ETestResultsFile -Tag $pri -PassThru Pop-Location } diff --git a/regress/pesterTests/FileBasedLogging.tests.ps1 b/regress/pesterTests/FileBasedLogging.tests.ps1 index aba0c938c..a78254a58 100644 --- a/regress/pesterTests/FileBasedLogging.tests.ps1 +++ b/regress/pesterTests/FileBasedLogging.tests.ps1 @@ -131,11 +131,11 @@ Describe "Tests for admin and non-admin file based logs" -Tags "CI" { if($OpenSSHTestInfo["NoLibreSSL"]) { - ssh-keygen.exe -t ed25519 -f $KeyFilePath -Z -P `"`" aes128-ctr + ssh-keygen.exe -t ed25519 -f $KeyFilePath -Z -P "" aes128-ctr } else { - ssh-keygen.exe -t ed25519 -f $KeyFilePath -P `"`" + ssh-keygen.exe -t ed25519 -f $KeyFilePath -P "" } Copy-Item "$keyFilePath.pub" $authorizedkeyPath -Force -ErrorAction SilentlyContinue Repair-AuthorizedKeyPermission -Filepath $authorizedkeyPath -confirm:$false From 47e734c1fbcd9deb537c8d0757a84e8a86dc9970 Mon Sep 17 00:00:00 2001 From: Vivian Thiebaut Date: Tue, 15 Nov 2022 14:25:48 -0500 Subject: [PATCH 3/8] Fix SSH tests --- contrib/win32/openssh/OpenSSHTestHelper.psm1 | 2 +- regress/pesterTests/SSH.Tests.ps1 | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/contrib/win32/openssh/OpenSSHTestHelper.psm1 b/contrib/win32/openssh/OpenSSHTestHelper.psm1 index eaf9ef4d5..a87a8573f 100644 --- a/contrib/win32/openssh/OpenSSHTestHelper.psm1 +++ b/contrib/win32/openssh/OpenSSHTestHelper.psm1 @@ -691,7 +691,7 @@ function Invoke-OpenSSHE2ETest Write-Log -Message "Running OpenSSH E2E tests..." # $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 .\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 } diff --git a/regress/pesterTests/SSH.Tests.ps1 b/regress/pesterTests/SSH.Tests.ps1 index f6ce8f9db..5b4c1bcf1 100644 --- a/regress/pesterTests/SSH.Tests.ps1 +++ b/regress/pesterTests/SSH.Tests.ps1 @@ -153,7 +153,7 @@ Describe "E2E scenarios for ssh client" -Tags "CI" { It "$tC.$tI - multiple double quotes in cmdline" { # 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" } @@ -219,19 +219,19 @@ Describe "E2E scenarios for ssh client" -Tags "CI" { } It "$tC.$tI - powershell as default shell and double quotes in cmdline" { # actual command line ssh target echo `"hello`" - $o = ssh test_target echo ``\`"hello``\`" + $o = ssh test_target echo `"hello`" $o | Should Be "`"hello`"" } It "$tC.$tI - multiple commands with double quotes in powershell cmdlet" -skip:$skip { # 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 $match = $o -match "Program Files" $match.count | Should be 1 } 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 - $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 #$o -contains "Program Files" | Should Be $True $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" { # actual command line ssh target echo "\"hello\"" - $o = ssh test_target 'echo "\"hello\""' + $o = ssh test_target echo "`"hello`"" $o | Should Be "`"hello`"" } 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" { # 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`"" } } @@ -302,7 +302,7 @@ Describe "E2E scenarios for ssh client" -Tags "CI" { $logFile | Should Contain "OpenSSH_" $logFile | Should Contain "Exit Status 0" } - +ssh It "$tC.$tI - cipher options (-c)" { #bad cipher From fea0542d1fcff60479ad60f76e1b1e6c4d5b82d4 Mon Sep 17 00:00:00 2001 From: Vivian Thiebaut Date: Tue, 15 Nov 2022 15:00:13 -0500 Subject: [PATCH 4/8] Run SSH and ShellHost tests --- contrib/win32/openssh/OpenSSHTestHelper.psm1 | 1 + regress/pesterTests/SSH.Tests.ps1 | 4 ++-- regress/pesterTests/ShellHost.Tests.ps1 | 24 ++++++++++---------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/contrib/win32/openssh/OpenSSHTestHelper.psm1 b/contrib/win32/openssh/OpenSSHTestHelper.psm1 index a87a8573f..61a845e48 100644 --- a/contrib/win32/openssh/OpenSSHTestHelper.psm1 +++ b/contrib/win32/openssh/OpenSSHTestHelper.psm1 @@ -692,6 +692,7 @@ function Invoke-OpenSSHE2ETest # $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 .\SSH.tests.ps1 -OutputFormat NUnitXml -OutputFile $Script:E2ETestResultsFile -Tag $pri -PassThru + Invoke-Pester .\ShellHost.tests.ps1 -OutputFormat NUnitXml -OutputFile $Script:E2ETestResultsFile -Tag $pri -PassThru Pop-Location } diff --git a/regress/pesterTests/SSH.Tests.ps1 b/regress/pesterTests/SSH.Tests.ps1 index 5b4c1bcf1..a2be65435 100644 --- a/regress/pesterTests/SSH.Tests.ps1 +++ b/regress/pesterTests/SSH.Tests.ps1 @@ -220,7 +220,7 @@ Describe "E2E scenarios for ssh client" -Tags "CI" { It "$tC.$tI - powershell as default shell and double quotes in cmdline" { # actual command line ssh 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 { # actual command line ssh target cd "$env:programfiles";pwd @@ -233,7 +233,7 @@ Describe "E2E scenarios for ssh client" -Tags "CI" { # actual command line ssh target dir "$env:programfiles";cd "$env:programfiles";pwd $o = ssh test_target "dir `"`$env:programfiles\`";cd `"`$env:programfiles\`";pwd" $LASTEXITCODE | Should Be 0 - #$o -contains "Program Files" | Should Be $True + #$o -contains "Program Files" | Shosshuld Be $True $match = $o -match "Program Files" $match.count | Should Be 3 } diff --git a/regress/pesterTests/ShellHost.Tests.ps1 b/regress/pesterTests/ShellHost.Tests.ps1 index a85edf22f..8a68cacbc 100644 --- a/regress/pesterTests/ShellHost.Tests.ps1 +++ b/regress/pesterTests/ShellHost.Tests.ps1 @@ -23,18 +23,18 @@ Describe "E2E scenarios for ssh-shellhost" -Tags "CI" { } It "$tC.$tI - various quote tests" -skip:$skip { - $o = ssh-shellhost -c cmd /c echo hello - $o | Should Be "hello" - $o = ssh-shellhost -c `"cmd /c echo hello`" - $o | Should Be "hello" - $o = ssh-shellhost -c cmd /c echo `"hello`" - $o | Should Be "`"hello`"" - $o = ssh-shellhost -c `"cmd /c echo `"hello`"`" - $o | Should Be "`"hello`"" - $o = ssh-shellhost -c `"cmd /c echo `"hello`" - $o | Should Be "`"hello" - $o = ssh-shellhost -c `"`"cmd`" /c echo `"hello`"`" - $o | Should Be "`"hello`"" + $o = ssh-shellhost -c cmd /c echo hello + $o | Should Be "hello" + $o = ssh-shellhost -c "cmd /c echo hello" + $o | Should Be "hello" + $o = ssh-shellhost -c cmd /c echo "hello" + $o | Should Be "hello" + $o = ssh-shellhost -c "cmd /c echo `"hello`"" + $o | Should Be "`\`"hello`\`"" + $o = ssh-shellhost -c "cmd /c echo `"hello" + $o | Should Be "`\`"hello" + $o = ssh-shellhost -c "cmd" /c echo "hello" + $o | Should Be "hello" } From 806eb6357669f68ddef808958724f28362f5bedc Mon Sep 17 00:00:00 2001 From: Vivian Thiebaut Date: Tue, 15 Nov 2022 15:29:31 -0500 Subject: [PATCH 5/8] Enable all tests --- .../AzDOBuildTools/AzDOBuildTools.psm1 | 124 +++++++++--------- contrib/win32/openssh/OpenSSHTestHelper.psm1 | 6 +- .../pesterTests/PlatformAbstractLayer.psm1 | 2 +- 3 files changed, 65 insertions(+), 67 deletions(-) diff --git a/contrib/win32/openssh/AzDOBuildTools/AzDOBuildTools.psm1 b/contrib/win32/openssh/AzDOBuildTools/AzDOBuildTools.psm1 index 85402bc80..9293a3475 100644 --- a/contrib/win32/openssh/AzDOBuildTools/AzDOBuildTools.psm1 +++ b/contrib/win32/openssh/AzDOBuildTools/AzDOBuildTools.psm1 @@ -200,20 +200,20 @@ function Invoke-OpenSSHTests # ... # FixHostFilePermissions.ps1 # ... - # Write-Verbose -Verbose -Message "Running Unit Tests..." - # Write-Verbose -Verbose -Message "Unit test directory is: ${OpenSSHBinPath}" + Write-Verbose -Verbose -Message "Running Unit Tests..." + Write-Verbose -Verbose -Message "Unit test directory is: ${OpenSSHBinPath}" - # $unitTestFailed = Invoke-OpenSSHUnitTest -UnitTestDirectory $OpenSSHBinPath + $unitTestFailed = Invoke-OpenSSHUnitTest -UnitTestDirectory $OpenSSHBinPath - # if($unitTestFailed) - # { - # Write-BuildMessage "At least one of the unit tests failed!" -Category Error - # $AllTestsPassed = $false - # } - # else - # { - # Write-BuildMessage -Message "All Unit tests passed!" -Category Information - # } + if($unitTestFailed) + { + Write-BuildMessage "At least one of the unit tests failed!" -Category Error + $AllTestsPassed = $false + } + else + { + Write-BuildMessage -Message "All Unit tests passed!" -Category Information + } # Run all E2E tests. Write-Verbose -Verbose -Message "Running E2E Tests..." @@ -239,62 +239,62 @@ function Invoke-OpenSSHTests } } - # # Bash tests. - # Write-Verbose -Verbose -Message "Running Bash Tests..." + # Bash tests. + Write-Verbose -Verbose -Message "Running Bash Tests..." - # # Ensure CygWin is installed, and install from Chocolatey if needed. - # $cygwinInstalled = $true - # $cygwinInstallLocation = "$env:SystemDrive/cygwin" - # if (! (Test-Path -Path "$cygwinInstallLocation/bin/sh.exe")) - # { - # Write-Verbose -Verbose -Message "CygWin not found" - # Install-CygWin -InstallLocation $cygwinInstallLocation + # Ensure CygWin is installed, and install from Chocolatey if needed. + $cygwinInstalled = $true + $cygwinInstallLocation = "$env:SystemDrive/cygwin" + if (! (Test-Path -Path "$cygwinInstallLocation/bin/sh.exe")) + { + Write-Verbose -Verbose -Message "CygWin not found" + Install-CygWin -InstallLocation $cygwinInstallLocation - # # Hack to fix up mangled CygWin directory, if needed. - # $expectedCygWinPath = "$env:SystemDrive/cygwin/bin/sh.exe" - # if (! (Test-Path -Path $expectedCygWinPath)) - # { - # Write-Verbose -Verbose -Message "CygWin did not install correctly, missing expected path: ${expectedCygWinPath}" + # Hack to fix up mangled CygWin directory, if needed. + $expectedCygWinPath = "$env:SystemDrive/cygwin/bin/sh.exe" + if (! (Test-Path -Path $expectedCygWinPath)) + { + Write-Verbose -Verbose -Message "CygWin did not install correctly, missing expected path: ${expectedCygWinPath}" - # $cygWinDirs = Get-Item -Path "$env:SystemDrive/cygwin*" - # if ($cygWinDirs.Count -gt 1) - # { - # Write-Verbose -Verbose -Message "CygWin install failed with mangled folder locations: ${cygWinDirs}" - # Write-Verbose -Verbose -Message 'TODO: Add hack to fix up CygWin folder.' - # } + $cygWinDirs = Get-Item -Path "$env:SystemDrive/cygwin*" + if ($cygWinDirs.Count -gt 1) + { + Write-Verbose -Verbose -Message "CygWin install failed with mangled folder locations: ${cygWinDirs}" + Write-Verbose -Verbose -Message 'TODO: Add hack to fix up CygWin folder.' + } - # Write-BuildMessage -Message "All bash tests failed because CygWin install failed" -Category Error - # $AllTestsPassed = $false - # $cygwinInstalled = $false - # } - # } + Write-BuildMessage -Message "All bash tests failed because CygWin install failed" -Category Error + $AllTestsPassed = $false + $cygwinInstalled = $false + } + } - # # Run UNIX bash tests. - # if ($cygwinInstalled) - # { - # Write-Verbose -Verbose -Message "Starting Bash Tests..." - # Invoke-OpenSSHBashTests - # if (-not $Global:bash_tests_summary) - # { - # $errorMessage = "Failed to start OpenSSH bash tests" - # Write-BuildMessage -Message $errorMessage -Category Error - # $AllTestsPassed = $false - # } - # else - # { - # if ($Global:bash_tests_summary["TotalBashTestsFailed"] -ne 0) - # { - # $total_bash_failed_tests = $Global:bash_tests_summary["TotalBashTestsFailed"] - # $total_bash_tests = $Global:bash_tests_summary["TotalBashTests"] - # $errorMessage = "At least one of the bash tests failed. [$total_bash_failed_tests of $total_bash_tests]" - # Write-BuildMessage -Message $errorMessage -Category Error - # $AllTestsPassed = $false - # } + # Run UNIX bash tests. + if ($cygwinInstalled) + { + Write-Verbose -Verbose -Message "Starting Bash Tests..." + Invoke-OpenSSHBashTests + if (-not $Global:bash_tests_summary) + { + $errorMessage = "Failed to start OpenSSH bash tests" + Write-BuildMessage -Message $errorMessage -Category Error + $AllTestsPassed = $false + } + else + { + if ($Global:bash_tests_summary["TotalBashTestsFailed"] -ne 0) + { + $total_bash_failed_tests = $Global:bash_tests_summary["TotalBashTestsFailed"] + $total_bash_tests = $Global:bash_tests_summary["TotalBashTests"] + $errorMessage = "At least one of the bash tests failed. [$total_bash_failed_tests of $total_bash_tests]" + Write-BuildMessage -Message $errorMessage -Category Error + $AllTestsPassed = $false + } - # $OpenSSHTestInfo["BashTestSummaryFile"] = $Global:bash_tests_summary["BashTestSummaryFile"] - # $OpenSSHTestInfo["BashTestLogFile"] = $Global:bash_tests_summary["BashTestLogFile"] - # } - # } + $OpenSSHTestInfo["BashTestSummaryFile"] = $Global:bash_tests_summary["BashTestSummaryFile"] + $OpenSSHTestInfo["BashTestLogFile"] = $Global:bash_tests_summary["BashTestLogFile"] + } + } # OpenSSH Uninstall Tests Invoke-OpenSSHUninstallTest diff --git a/contrib/win32/openssh/OpenSSHTestHelper.psm1 b/contrib/win32/openssh/OpenSSHTestHelper.psm1 index 61a845e48..2d5b2118d 100644 --- a/contrib/win32/openssh/OpenSSHTestHelper.psm1 +++ b/contrib/win32/openssh/OpenSSHTestHelper.psm1 @@ -689,10 +689,8 @@ function Invoke-OpenSSHE2ETest # Discover all CI tests and run them. Push-Location $Script:E2ETestDirectory Write-Log -Message "Running OpenSSH E2E tests..." - # $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 .\SSH.tests.ps1 -OutputFormat NUnitXml -OutputFile $Script:E2ETestResultsFile -Tag $pri -PassThru - Invoke-Pester .\ShellHost.tests.ps1 -OutputFormat NUnitXml -OutputFile $Script:E2ETestResultsFile -Tag $pri -PassThru + $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 Pop-Location } diff --git a/regress/pesterTests/PlatformAbstractLayer.psm1 b/regress/pesterTests/PlatformAbstractLayer.psm1 index 5ea304d70..9d59bfa15 100644 --- a/regress/pesterTests/PlatformAbstractLayer.psm1 +++ b/regress/pesterTests/PlatformAbstractLayer.psm1 @@ -19,7 +19,7 @@ Enum PlatformType { function Set-Platform { # Use the .NET Core APIs to determine the current platform; if a runtime # exception is thrown, we are on FullCLR, not .NET Core. - if($IsOSX) { + if($IsMacOS) { [PlatformType]::OSX } elseif($IsLinux) { [PlatformType]::Linux From f574496b3ff375be57aab45567e258c9435bf3b0 Mon Sep 17 00:00:00 2001 From: Vivian Thiebaut <81188381+vthiebaut10@users.noreply.github.com> Date: Wed, 16 Nov 2022 10:30:21 -0500 Subject: [PATCH 6/8] Apply suggestions from code review Co-authored-by: Paul Higinbotham --- regress/pesterTests/SSH.Tests.ps1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/regress/pesterTests/SSH.Tests.ps1 b/regress/pesterTests/SSH.Tests.ps1 index a2be65435..ecb676833 100644 --- a/regress/pesterTests/SSH.Tests.ps1 +++ b/regress/pesterTests/SSH.Tests.ps1 @@ -152,7 +152,7 @@ Describe "E2E scenarios for ssh client" -Tags "CI" { } 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 | Should Be "hello" } @@ -223,14 +223,14 @@ Describe "E2E scenarios for ssh client" -Tags "CI" { $o | Should Be "hello" } 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" $LASTEXITCODE | Should Be 0 $match = $o -match "Program Files" $match.count | Should be 1 } 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" $LASTEXITCODE | Should Be 0 #$o -contains "Program Files" | Shosshuld Be $True @@ -262,7 +262,7 @@ Describe "E2E scenarios for ssh client" -Tags "CI" { $o | Should Contain "cmd" } 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 | Should Be "`"hello`"" } @@ -285,7 +285,7 @@ Describe "E2E scenarios for ssh client" -Tags "CI" { Remove-ItemProperty -Path $dfltShellRegPath -Name $dfltShellCmdOptionRegKeyName -ErrorAction SilentlyContinue } 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 | Should Be "`"hello`"" } From 4e1aee3a974e0fb30a18a536f5ee49ab9375b58c Mon Sep 17 00:00:00 2001 From: Vivian Thiebaut Date: Wed, 16 Nov 2022 10:32:11 -0500 Subject: [PATCH 7/8] remove typo --- regress/pesterTests/SSH.Tests.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/regress/pesterTests/SSH.Tests.ps1 b/regress/pesterTests/SSH.Tests.ps1 index ecb676833..48e26bc68 100644 --- a/regress/pesterTests/SSH.Tests.ps1 +++ b/regress/pesterTests/SSH.Tests.ps1 @@ -302,7 +302,6 @@ Describe "E2E scenarios for ssh client" -Tags "CI" { $logFile | Should Contain "OpenSSH_" $logFile | Should Contain "Exit Status 0" } -ssh It "$tC.$tI - cipher options (-c)" { #bad cipher From 127afa01f4bf4214deba5b9bc379cfbae6b5d54f Mon Sep 17 00:00:00 2001 From: Vivian Thiebaut Date: Wed, 16 Nov 2022 10:37:16 -0500 Subject: [PATCH 8/8] Fix typos --- regress/pesterTests/SSH.Tests.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/regress/pesterTests/SSH.Tests.ps1 b/regress/pesterTests/SSH.Tests.ps1 index 48e26bc68..015727134 100644 --- a/regress/pesterTests/SSH.Tests.ps1 +++ b/regress/pesterTests/SSH.Tests.ps1 @@ -233,7 +233,7 @@ Describe "E2E scenarios for ssh client" -Tags "CI" { # actual command line ssh target dir "$env:programfiles\";cd "$env:programfiles\";pwd $o = ssh test_target "dir `"`$env:programfiles\`";cd `"`$env:programfiles\`";pwd" $LASTEXITCODE | Should Be 0 - #$o -contains "Program Files" | Shosshuld Be $True + #$o -contains "Program Files" | Should Be $True $match = $o -match "Program Files" $match.count | Should Be 3 } @@ -303,6 +303,7 @@ Describe "E2E scenarios for ssh client" -Tags "CI" { $logFile | Should Contain "Exit Status 0" } + It "$tC.$tI - cipher options (-c)" { #bad cipher iex "cmd /c `"ssh -c bad_cipher test_target echo 1234 2>$stderrFile`""