diff --git a/Tests/Integration/GroupSet.Integration.Tests.ps1 b/Tests/Integration/GroupSet.Integration.Tests.ps1 index f4bc0f9..e482b24 100644 --- a/Tests/Integration/GroupSet.Integration.Tests.ps1 +++ b/Tests/Integration/GroupSet.Integration.Tests.ps1 @@ -11,8 +11,8 @@ $errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' # Import CommonTestHelper for Enter-DscResourceTestEnvironment, Exit-DscResourceTestEnvironment -$script:testsFolderFilePath = Split-Path $PSScriptRoot -Parent -$script:testHelpersPath = Join-Path -Path $script:testsFolderFilePath -ChildPath 'TestHelpers' +$script:testFolderPath = Split-Path -Path $PSScriptRoot -Parent +$script:testHelpersPath = Join-Path -Path $script:testFolderPath -ChildPath 'TestHelpers' Import-Module -Name (Join-Path -Path $script:testHelpersPath -ChildPath 'CommonTestHelper.psm1') diff --git a/Tests/Integration/MSFT_RegistryResource.EndToEnd.Tests.ps1 b/Tests/Integration/MSFT_RegistryResource.EndToEnd.Tests.ps1 index c9a31d9..61b14f5 100644 --- a/Tests/Integration/MSFT_RegistryResource.EndToEnd.Tests.ps1 +++ b/Tests/Integration/MSFT_RegistryResource.EndToEnd.Tests.ps1 @@ -5,13 +5,19 @@ If this happens to you, it is fixable, but the fix is difficult and time-consuming. #> +if ($PSVersionTable.PSVersion.Major -lt 5 -or $PSVersionTable.PSVersion.Minor -lt 1) +{ + Write-Warning -Message 'Cannot run PSDscResources integration tests on PowerShell versions lower than 5.1' + return +} + $errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' # Import CommonTestHelper for Enter-DscResourceTestEnvironment, Exit-DscResourceTestEnvironment -$script:testsFolderFilePath = Split-Path $PSScriptRoot -Parent -$script:commonTestHelperFilePath = Join-Path -Path $testsFolderFilePath -ChildPath 'CommonTestHelper.psm1' -Import-Module -Name $commonTestHelperFilePath +$script:testFolderPath = Split-Path -Path $PSScriptRoot -Parent +$script:testHelpersPath = Join-Path -Path $script:testFolderPath -ChildPath 'TestHelpers' +Import-Module -Name (Join-Path -Path $script:testHelpersPath -ChildPath 'CommonTestHelper.psm1') $script:testEnvironment = Enter-DscResourceTestEnvironment ` -DscResourceModuleName 'PSDscResources' ` @@ -23,7 +29,7 @@ try Describe 'Registry End to End Tests' { BeforeAll { # Import Registry resource module for Get-TargetResource, Test-TargetResource, Set-TargetResource - $moduleRootFilePath = Split-Path -Path $script:testsFolderFilePath -Parent + $moduleRootFilePath = Split-Path -Path $script:testFolderPath -Parent $dscResourcesFolderFilePath = Join-Path -Path $moduleRootFilePath -ChildPath 'DscResources' $registryResourceFolderFilePath = Join-Path -Path $dscResourcesFolderFilePath -ChildPath 'MSFT_RegistryResource' $registryResourceModuleFilePath = Join-Path -Path $registryResourceFolderFilePath -ChildPath 'MSFT_RegistryResource.psm1' diff --git a/Tests/Integration/MSFT_RegistryResource.Integration.Tests.ps1 b/Tests/Integration/MSFT_RegistryResource.Integration.Tests.ps1 index ea6883d..f6fce3b 100644 --- a/Tests/Integration/MSFT_RegistryResource.Integration.Tests.ps1 +++ b/Tests/Integration/MSFT_RegistryResource.Integration.Tests.ps1 @@ -9,8 +9,8 @@ $errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' # Import CommonTestHelper for Enter-DscResourceTestEnvironment, Exit-DscResourceTestEnvironment -$script:testsFolderFilePath = Split-Path $PSScriptRoot -Parent -$script:testHelpersPath = Join-Path -Path $script:testFolderFilePath -ChildPath 'TestHelpers' +$script:testFolderPath = Split-Path -Path $PSScriptRoot -Parent +$script:testHelpersPath = Join-Path -Path $script:testFolderPath -ChildPath 'TestHelpers' Import-Module -Name (Join-Path -Path $script:testHelpersPath -ChildPath 'CommonTestHelper.psm1') $script:testEnvironment = Enter-DscResourceTestEnvironment ` @@ -27,7 +27,7 @@ try Import-Module -Name $registryTestHelperFilePath -Force # Import Registry resource module for Get-TargetResource, Test-TargetResource, Set-TargetResource - $moduleRootFilePath = Split-Path -Path $script:testsFolderFilePath -Parent + $moduleRootFilePath = Split-Path -Path $script:testFolderPath -Parent $dscResourcesFolderFilePath = Join-Path -Path $moduleRootFilePath -ChildPath 'DscResources' $registryResourceFolderFilePath = Join-Path -Path $dscResourcesFolderFilePath -ChildPath 'MSFT_RegistryResource' $registryResourceModuleFilePath = Join-Path -Path $registryResourceFolderFilePath -ChildPath 'MSFT_RegistryResource.psm1' diff --git a/Tests/Integration/MSFT_ScriptResource.Integration.Tests.ps1 b/Tests/Integration/MSFT_ScriptResource.Integration.Tests.ps1 index c9586a5..52bb41b 100644 --- a/Tests/Integration/MSFT_ScriptResource.Integration.Tests.ps1 +++ b/Tests/Integration/MSFT_ScriptResource.Integration.Tests.ps1 @@ -9,8 +9,8 @@ if ($PSVersionTable.PSVersion.Major -lt 5 -or $PSVersionTable.PSVersion.Minor -l # Import CommonTestHelper for Enter-DscResourceTestEnvironment, Exit-DscResourceTestEnvironment $script:moduleRootPath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent -$script:testPath = Split-Path -Path $PSScriptRoot -Parent -$script:testHelpersPath = Join-Path -Path $script:testPath -ChildPath 'TestHelpers' +$script:testFolderPath = Split-Path -Path $PSScriptRoot -Parent +$script:testHelpersPath = Join-Path -Path $script:testFolderPath -ChildPath 'TestHelpers' Import-Module -Name (Join-Path -Path $script:testHelpersPath -ChildPath 'CommonTestHelper.psm1') $script:testEnvironment = Enter-DscResourceTestEnvironment ` diff --git a/Tests/Integration/MSFT_ServiceResource.Integration.Tests.ps1 b/Tests/Integration/MSFT_ServiceResource.Integration.Tests.ps1 index 527b16c..aea088a 100644 --- a/Tests/Integration/MSFT_ServiceResource.Integration.Tests.ps1 +++ b/Tests/Integration/MSFT_ServiceResource.Integration.Tests.ps1 @@ -18,8 +18,8 @@ Set-StrictMode -Version 'Latest' # Import CommonTestHelper for Enter-DscResourceTestEnvironment, Exit-DscResourceTestEnvironment $script:moduleRootPath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent -$script:testPath = Split-Path -Path $PSScriptRoot -Parent -$script:testHelpersPath = Join-Path -Path $script:testPath -ChildPath 'TestHelpers' +$script:testFolderPath = Split-Path -Path $PSScriptRoot -Parent +$script:testHelpersPath = Join-Path -Path $script:testFolderPath -ChildPath 'TestHelpers' Import-Module -Name (Join-Path -Path $script:testHelpersPath -ChildPath 'CommonTestHelper.psm1') $script:testEnvironment = Enter-DscResourceTestEnvironment ` diff --git a/Tests/Unit/MSFT_RegistryResource.Tests.ps1 b/Tests/Unit/MSFT_RegistryResource.Tests.ps1 index 364e311..fd64def 100644 --- a/Tests/Unit/MSFT_RegistryResource.Tests.ps1 +++ b/Tests/Unit/MSFT_RegistryResource.Tests.ps1 @@ -2,8 +2,8 @@ $errorActionPreference = 'Stop' Set-StrictMode -Version 'Latest' # Import CommonTestHelper for Enter-DscResourceTestEnvironment, Exit-DscResourceTestEnvironment -$script:testsFolderFilePath = Split-Path $PSScriptRoot -Parent -$script:testHelpersPath = Join-Path -Path $script:testFolderFilePath -ChildPath 'TestHelpers' +$script:testFolderPath = Split-Path -Path $PSScriptRoot -Parent +$script:testHelpersPath = Join-Path -Path $script:testFolderPath -ChildPath 'TestHelpers' Import-Module -Name (Join-Path -Path $script:testHelpersPath -ChildPath 'CommonTestHelper.psm1') $script:testEnvironment = Enter-DscResourceTestEnvironment `