Skip to content

Commit 83d33b1

Browse files
committed
Fix test on checking profile versions
1 parent 59172d7 commit 83d33b1

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

src/ResourceManager/Profile/CheckVersions.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ $AzureRMModules = @(
2323
"AzureRM.Websites"
2424
)
2525

26-
$AvailableModules = @()
26+
$global:AvailableModules = @()
2727

2828
function CheckVersions {
2929
$profile = GetModuleInfo("AzureRM.Profile")

src/ResourceManager/Profile/Commands.Profile.Test/Commands.Profile.Test.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,10 @@
194194
</Content>
195195
<None Include="MSSharedLibKey.snk" />
196196
<None Include="packages.config" />
197-
<None Include="ProfileModuleTestRepo\AzureRM.ApiManagement.998.9.8.nupkg">
197+
<None Include="FakeModuleRepo\AzureRM.ApiManagement.998.9.8.nupkg">
198198
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
199199
</None>
200-
<None Include="ProfileModuleTestRepo\AzureRM.Profile.999.9.8.nupkg">
200+
<None Include="FakeModuleRepo\AzureRM.Profile.999.9.8.nupkg">
201201
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
202202
</None>
203203
<None Include="SessionRecords\Microsoft.Azure.Commands.Profile.Test.SubscriptionCmdletTests\AllParameterSetsSucceed.json">
@@ -231,4 +231,4 @@
231231
<ItemGroup />
232232
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
233233
<Import Project="..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
234-
</Project>
234+
</Project>

src/ResourceManager/Profile/Commands.Profile.Test/ProfileModuleTests.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,25 @@
1414

1515
<#
1616
.SYNOPSIS
17-
Tests each of the major parts of retrieving subscriptions in ARM mode
17+
Tests warning gets printed on incompatible modules with profile
1818
#>
1919
function Test-LoadProfileModule
2020
{
21+
# Push current profile module
22+
$global:pushedProfileModule = $(Get-Module AzureRM.Profile).Path
23+
Remove-Module AzureRM.Profile
2124
try {
2225
Register-PSRepository -Name "ProfileModuleTest" -SourceLocation (Resolve-Path .\).Path -InstallationPolicy Trusted
2326
try {
2427
Install-Module AzureRM.ApiManagement -Scope CurrentUser -Repository ProfileModuleTest -RequiredVersion 998.9.8
25-
$buffer = Import-Module AzureRM.Profile 2>&1 3>&1 | Out-String
28+
$global:buffer = Import-Module $global:pushedProfileModule 2>&1 3>&1 | Out-String
29+
Write-Warning $global:buffer
30+
Assert-True { $global:buffer -Like "*AzureRM.ApiManagement 998.9.8 is not compatible with AzureRM.Profile*" }
2631
} finally {
2732
Uninstall-Module AzureRM.ApiManagement -ErrorAction Ignore
2833
Uninstall-Module AzureRM.Profile -ErrorAction Ignore
2934
}
3035
} finally {
3136
Unregister-PSRepository -Name "ProfileModuleTest"
3237
}
33-
Assert-True { $buffer -Like "*AzureRM.ApiManagement 998.9.8 is not compatible with AzureRM.Profile*" }
3438
}

0 commit comments

Comments
 (0)