mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Add 'RequireAdminOnWindows' tag to some tests suites
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -65,17 +65,17 @@ function RunTestCase
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Validate that get-help <cmdletName> works" -Tags "CI" {
|
||||
Describe "Validate that get-help <cmdletName> 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'
|
||||
|
||||
Reference in New Issue
Block a user