From 5e2b081a49d2201ef5eb3d4305faa930e77538b2 Mon Sep 17 00:00:00 2001 From: Tess Gauthier Date: Tue, 11 Oct 2022 18:40:39 -0400 Subject: [PATCH] modify -p tests to only run for Windows OS version 10 and above --- regress/pesterTests/SCP.Tests.ps1 | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/regress/pesterTests/SCP.Tests.ps1 b/regress/pesterTests/SCP.Tests.ps1 index 041ba4569..20fcbf515 100644 --- a/regress/pesterTests/SCP.Tests.ps1 +++ b/regress/pesterTests/SCP.Tests.ps1 @@ -52,7 +52,13 @@ Describe "Tests for scp command" -Tags "CI" { Source = $SourceFilePath Destination = "test_target:$DestinationFilePath" Options = "-S `"$sshcmd`"" - }, + }, + @{ + Title = 'Simple copy remote file to local file' + Source = "test_target:$SourceFilePath" + Destination = $DestinationFilePath + Options = "-p -c aes128-ctr -C" + }, @{ Title = 'Simple copy local file to local dir' Source = $SourceFilePath @@ -174,11 +180,8 @@ Describe "Tests for scp command" -Tags "CI" { $equal = @(Compare-Object (Get-ChildItem -path $SourceFilePath) (Get-ChildItem -path $DestinationFilePath) -Property Name, Length ).Length -eq 0 $equal | Should Be $true - if($Options.contains("-p ")) + if($Options.contains("-p ") -and [System.Convert]::ToInt32((Get-WMIObject win32_operatingsystem).Version.Split(".")[0]) -ge 10) { - # TODO: Test only - Write-Verbose -Verbose "Source File LastWriteTime: $((Get-ChildItem -Path $SourceFilePath).LastWriteTime.DateTime)" - Write-Verbose -Verbose "Dest File LastWriteTime: $((Get-ChildItem -Path $DestinationFilePath).LastWriteTime.DateTime)" $equal = @(Compare-Object (Get-ChildItem -path $SourceFilePath).LastWriteTime.DateTime (Get-ChildItem -path $DestinationFilePath).LastWriteTime.DateTime ).Length -eq 0 $equal | Should Be $true }