Skip to content

Commit 03ac34c

Browse files
committed
Disable test
1 parent f470c1d commit 03ac34c

File tree

1 file changed

+65
-65
lines changed

1 file changed

+65
-65
lines changed
Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,73 @@
1-
# Copyright (c) Microsoft Corporation.
2-
# Licensed under the MIT License.
1+
# # Copyright (c) Microsoft Corporation.
2+
# # Licensed under the MIT License.
33

4-
BeforeDiscovery {
5-
if ($IsWindows) {
6-
$identity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
7-
$principal = [System.Security.Principal.WindowsPrincipal]::new($identity)
8-
$isElevated = $principal.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)
4+
# BeforeDiscovery {
5+
# if ($IsWindows) {
6+
# $identity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
7+
# $principal = [System.Security.Principal.WindowsPrincipal]::new($identity)
8+
# $isElevated = $principal.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)
99

10-
if ($env:GITHUB_ACTION) {
11-
$script:currentModulePaths = $env:PSModulePath
12-
Write-Verbose -Message "Running in GitHub Actions" -Verbose
13-
# Uninstall the PSDesiredStateConfiguration module as this requires v1.1 and the build script installs it
14-
Uninstall-PSResource -Name 'PSDesiredStateConfiguration' -Version 2.0.7 -ErrorAction Stop
15-
# Get current PSModulePath and exclude PowerShell 7 paths
16-
$currentPaths = $env:PSModulePath -split ';' | Where-Object {
17-
$_ -notmatch 'PowerShell[\\/]7' -and
18-
$_ -notmatch 'Program Files[\\/]PowerShell[\\/]' -and
19-
$_ -notmatch 'Documents[\\/]PowerShell[\\/]'
20-
}
10+
# if ($env:GITHUB_ACTION) {
11+
# $script:currentModulePaths = $env:PSModulePath
12+
# Write-Verbose -Message "Running in GitHub Actions" -Verbose
13+
# # Uninstall the PSDesiredStateConfiguration module as this requires v1.1 and the build script installs it
14+
# Uninstall-PSResource -Name 'PSDesiredStateConfiguration' -Version 2.0.7 -ErrorAction Stop
15+
# # Get current PSModulePath and exclude PowerShell 7 paths
16+
# $currentPaths = $env:PSModulePath -split ';' | Where-Object {
17+
# $_ -notmatch 'PowerShell[\\/]7' -and
18+
# $_ -notmatch 'Program Files[\\/]PowerShell[\\/]' -and
19+
# $_ -notmatch 'Documents[\\/]PowerShell[\\/]'
20+
# }
2121

22-
# Check if Windows PowerShell modules path exists
23-
$windowsPSPath = "$env:SystemRoot\System32\WindowsPowerShell\v1.0\Modules"
24-
if ($windowsPSPath -notin $currentPaths) {
25-
$currentPaths += $windowsPSPath
26-
}
22+
# # Check if Windows PowerShell modules path exists
23+
# $windowsPSPath = "$env:SystemRoot\System32\WindowsPowerShell\v1.0\Modules"
24+
# if ($windowsPSPath -notin $currentPaths) {
25+
# $currentPaths += $windowsPSPath
26+
# }
2727

28-
# Update PSModulePath
29-
$env:PSModulePath = $currentPaths -join ';'
30-
}
31-
}
32-
}
28+
# # Update PSModulePath
29+
# $env:PSModulePath = $currentPaths -join ';'
30+
# }
31+
# }
32+
# }
3333

34-
Describe 'PowerShell extension tests' {
35-
It 'Example PowerShell file should work' -Skip:(!$IsWindows -or !$isElevated) {
36-
$psFile = Resolve-Path -Path "$PSScriptRoot\..\..\dsc\examples\variable.dsc.ps1"
37-
$out = dsc -l trace config get -f $psFile 2>$TestDrive/error.log | ConvertFrom-Json
38-
$LASTEXITCODE | Should -Be 0 -Because (Get-Content -Path $TestDrive/error.log -Raw | Out-String)
39-
$out.results[0].result.actualState.Ensure | Should -Be 'Absent'
40-
(Get-Content -Path $TestDrive/error.log -Raw) | Should -Match "Importing file '$psFile' with extension 'Microsoft.DSC.Extension/PowerShell'"
41-
}
34+
# Describe 'PowerShell extension tests' {
35+
# It 'Example PowerShell file should work' -Skip:(!$IsWindows -or !$isElevated) {
36+
# $psFile = Resolve-Path -Path "$PSScriptRoot\..\..\dsc\examples\variable.dsc.ps1"
37+
# $out = dsc -l trace config get -f $psFile 2>$TestDrive/error.log | ConvertFrom-Json
38+
# $LASTEXITCODE | Should -Be 0 -Because (Get-Content -Path $TestDrive/error.log -Raw | Out-String)
39+
# $out.results[0].result.actualState.Ensure | Should -Be 'Absent'
40+
# (Get-Content -Path $TestDrive/error.log -Raw) | Should -Match "Importing file '$psFile' with extension 'Microsoft.DSC.Extension/PowerShell'"
41+
# }
4242

43-
It 'Invalid PowerShell configuration document file returns error' -Skip:(!$IsWindows) {
44-
$psFile = "$TestDrive/invalid.ps1"
45-
Set-Content -Path $psFile -Value @"
46-
configuration InvalidConfiguration {
47-
Import-DscResource -ModuleName InvalidModule
48-
Node localhost
49-
{
50-
Test Invalid {
51-
Name = 'InvalidTest'
52-
Ensure = 'Present'
53-
}
54-
}
55-
}
56-
"@
57-
dsc -l trace config get -f $psFile 2>$TestDrive/error.log
58-
$LASTEXITCODE | Should -Be 2 -Because (Get-Content -Path $TestDrive/error.log -Raw | Out-String)
59-
$content = (Get-Content -Path $TestDrive/error.log -Raw)
60-
$content | Should -BeLike "*Importing file '$psFile' with extension 'Microsoft.DSC.Extension/WindowsPowerShell'*"
61-
$content | Should -Match "No DSC resources found in the imported modules."
62-
}
63-
}
43+
# It 'Invalid PowerShell configuration document file returns error' -Skip:(!$IsWindows) {
44+
# $psFile = "$TestDrive/invalid.ps1"
45+
# Set-Content -Path $psFile -Value @"
46+
# configuration InvalidConfiguration {
47+
# Import-DscResource -ModuleName InvalidModule
48+
# Node localhost
49+
# {
50+
# Test Invalid {
51+
# Name = 'InvalidTest'
52+
# Ensure = 'Present'
53+
# }
54+
# }
55+
# }
56+
# "@
57+
# dsc -l trace config get -f $psFile 2>$TestDrive/error.log
58+
# $LASTEXITCODE | Should -Be 2 -Because (Get-Content -Path $TestDrive/error.log -Raw | Out-String)
59+
# $content = (Get-Content -Path $TestDrive/error.log -Raw)
60+
# $content | Should -BeLike "*Importing file '$psFile' with extension 'Microsoft.DSC.Extension/WindowsPowerShell'*"
61+
# $content | Should -Match "No DSC resources found in the imported modules."
62+
# }
63+
# }
6464

65-
AfterAll {
66-
if ($IsWindows -and $env:GITHUB_ACTION) {
67-
Install-PSResource -Name 'PSDesiredStateConfiguration' -Version 2.0.7 -ErrorAction Stop -TrustRepository -Reinstall
68-
}
65+
# AfterAll {
66+
# if ($IsWindows -and $env:GITHUB_ACTION) {
67+
# Install-PSResource -Name 'PSDesiredStateConfiguration' -Version 2.0.7 -ErrorAction Stop -TrustRepository -Reinstall
68+
# }
6969

70-
Write-Verbose -Message "Restoring original PSModulePath" -Verbose
71-
Write-Verbose -Message ($script:currentModulePaths) -Verbose
72-
$env:PSModulePath = $script:currentModulePaths
73-
}
70+
# Write-Verbose -Message "Restoring original PSModulePath" -Verbose
71+
# Write-Verbose -Message ($script:currentModulePaths) -Verbose
72+
# $env:PSModulePath = $script:currentModulePaths
73+
# }

0 commit comments

Comments
 (0)