Skip to content

Commit 9805feb

Browse files
committed
Fixing Admin Pester tests
1 parent 47330ed commit 9805feb

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

tools/Modules/Run-UnitTests.ps1

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,9 @@ if ($Scope -in $AzureScopes) {
117117

118118
if ($Scope -in $StackScopes) {
119119

120-
# Download and add AzureRM.Profile 3.4.1 to PSModulePath
121-
[System.String]$SavePath = (Join-Path -Path $PSScriptRoot -ChildPath "tmp")
122-
if (-not(Test-Path $SavePath)) {
123-
New-Item -Path $SavePath -ItemType Directory -Force | Out-Null
124-
Save-Module -Name AzureRM.Profile -RequiredVersion 3.4.1 -Repository PSGallery -Path $SavePath | Out-Null
125-
Save-Module -Name AzureRM.Resources -RequiredVersion 4.4.1 -Repository PSGallery -Path $SavePath | Out-Null
126-
}
127-
128-
$oldModulePath = $env:PSModulePath.Clone()
129-
[Environment]::SetEnvironmentVariable("PSModulePath","$env:PSModulePath;$SavePath")
120+
$ARMRoot = "$PSScriptRoot\..\..\src\Stack\$BuildConfig\ResourceManager\AzureResourceManager"
121+
Import-Module "$ARMRoot\AzureRM.Profile\AzureRM.Profile.psd1"
122+
Import-Module "$ARMRoot\AzureRM.Resources\AzureRM.Resources.psd1";
130123

131124
# All admin modules
132125
$AllStackModules = @(
@@ -151,6 +144,5 @@ if ($Scope -in $StackScopes) {
151144
[System.String[]]$ModulesToTest = $AllStackModules | Where-Object { !($_ -in $IgnoredStackModules) }
152145
Test-Stack -BuildConfig $BuildConfig -Modules $ModulesToTest
153146

154-
[Environment]::SetEnvironmentVariable("PSModulePath",$oldModulePath)
155147
}
156148

0 commit comments

Comments
 (0)