diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Get-Process.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Get-Process.Tests.ps1 index 97d83b4871..2be5bbb79d 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Get-Process.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Get-Process.Tests.ps1 @@ -1,8 +1,10 @@ -Describe "Get-Process" -Tags "CI" { +Describe "Get-Process for admin" -Tags @('CI', 'RequireAdminOnWindows') { It "Should support -IncludeUserName" { (Get-Process powershell -IncludeUserName | Select-Object -First 1).UserName | Should Match $env:USERNAME } +} +Describe "Get-Process" -Tags "CI" { # These tests are no good, please replace! It "Should return a type of Object[] for Get-Process cmdlet" -Pending:$IsOSX { (Get-Process).GetType().BaseType | Should Be 'array' diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/New-Item.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/New-Item.Tests.ps1 index 9fa0188be2..9197ad9d1c 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/New-Item.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/New-Item.Tests.ps1 @@ -104,6 +104,36 @@ Describe "New-Item" -Tags "CI" { Test-Path $FullyQualifiedFile | Should Be $false } + It "Should create a hard link of a file without error" { + New-Item -Name $testfile -Path $tmpDirectory -ItemType file + Test-Path $FullyQualifiedFile | Should Be $true + + New-Item -ItemType HardLink -Target $FullyQualifiedFile -Name $testlink -Path $tmpDirectory + Test-Path $FullyQualifiedLink | Should Be $true + + $fileInfo = Get-ChildItem $FullyQualifiedLink + $fileInfo.Target | Should Be $null + $fileInfo.LinkType | Should Be "HardLink" + } +} + +# More precisely these tests require SeCreateSymbolicLinkPrivilege. +# You can see list of priveledges with `whoami /priv`. +# In the default windows setup, Admin user has this priveledge, but regular users don't. + +Describe "New-Item with links" -Tags @('CI', 'RequireAdminOnWindows') { + $tmpDirectory = $TestDrive + $testfile = "testfile.txt" + $testfolder = "newDirectory" + $testlink = "testlink" + $FullyQualifiedFile = Join-Path -Path $tmpDirectory -ChildPath $testfile + $FullyQualifiedFolder = Join-Path -Path $tmpDirectory -ChildPath $testfolder + $FullyQualifiedLink = Join-Path -Path $tmpDirectory -ChildPath $testlink + + BeforeEach { + Clean-State + } + It "Should create a symbolic link of a file without error" { New-Item -Name $testfile -Path $tmpDirectory -ItemType file Test-Path $FullyQualifiedFile | Should Be $true @@ -141,17 +171,4 @@ Describe "New-Item" -Tags "CI" { # Remove the link explicitly to avoid broken symlink issue Remove-Item $FullyQualifiedLink -Force } - - It "Should create a hard link of a file without error" { - New-Item -Name $testfile -Path $tmpDirectory -ItemType file - Test-Path $FullyQualifiedFile | Should Be $true - - New-Item -ItemType HardLink -Target $FullyQualifiedFile -Name $testlink -Path $tmpDirectory - Test-Path $FullyQualifiedLink | Should Be $true - - $fileInfo = Get-ChildItem $FullyQualifiedLink - $fileInfo.Target | Should Be $null - $fileInfo.LinkType | Should Be "HardLink" - } - } diff --git a/test/powershell/engine/HelpSystem.Tests.ps1 b/test/powershell/engine/HelpSystem.Tests.ps1 index 527aa8afcd..e076b98913 100644 --- a/test/powershell/engine/HelpSystem.Tests.ps1 +++ b/test/powershell/engine/HelpSystem.Tests.ps1 @@ -65,17 +65,17 @@ function RunTestCase } } -Describe "Validate that get-help works" -Tags "CI" { +Describe "Validate that get-help works" -Tags @('CI', 'RequireAdminOnWindows') { RunTestCase -tag "CI" } -Describe "Validate Get-Help for all cmdlets in 'Microsoft.PowerShell.Core'" -Tags "Feature" { +Describe "Validate Get-Help for all cmdlets in 'Microsoft.PowerShell.Core'" -Tags @('Feature', 'RequireAdminOnWindows') { RunTestCase -tag "Feature" } -Describe "Validate that Get-Help returns provider-specific help" -Tags "CI" { +Describe "Validate that Get-Help returns provider-specific help" -Tags @('CI', 'RequireAdminOnWindows') { BeforeAll { $namespaces = @{ command = 'http://schemas.microsoft.com/maml/dev/command/2004/10'