From 55df531587048347a11f2f4b19f4295305697b1c Mon Sep 17 00:00:00 2001 From: Manoj Ampalam Date: Mon, 28 Aug 2017 12:13:01 -0700 Subject: [PATCH] Updated tests to reflect merged changes --- regress/pesterTests/KeyUtils.Tests.ps1 | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/regress/pesterTests/KeyUtils.Tests.ps1 b/regress/pesterTests/KeyUtils.Tests.ps1 index f51645f5b..50f0e5ea5 100644 --- a/regress/pesterTests/KeyUtils.Tests.ps1 +++ b/regress/pesterTests/KeyUtils.Tests.ps1 @@ -38,7 +38,10 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" { #only validate owner and ACEs of the file function ValidateKeyFile { - param([string]$FilePath) + param( + [string]$FilePath, + [bool]$IsHostKey = $true + ) $myACL = Get-ACL $FilePath $currentOwnerSid = Get-UserSid -User $myACL.Owner @@ -53,8 +56,14 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" { $FullControlPerm = [System.UInt32] [System.Security.AccessControl.FileSystemRights]::FullControl.value__ if($FilePath.EndsWith(".pub")) { - $myACL.Access.Count | Should Be 4 - $identities = @($systemSid, $adminsSid, $currentUserSid, $everyoneSid) + if ($IsHostKey) { + $myACL.Access.Count | Should Be 3 + $identities = @($systemSid, $adminsSid, $currentUserSid) + } + else { + $myACL.Access.Count | Should Be 4 + $identities = @($systemSid, $adminsSid, $currentUserSid, $everyoneSid) + } } else { $myACL.Access.Count | Should Be 3 @@ -135,7 +144,7 @@ Describe "E2E scenarios for ssh key management" -Tags "CI" { ssh-keygen -t $type -P $keypassphrase -f $keyPath } ValidateKeyFile -FilePath $keyPath - ValidateKeyFile -FilePath "$keyPath.pub" + ValidateKeyFile -FilePath "$keyPath.pub" -IsHostKey $false } } }