Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Microsoft.Azure.Commands.Profile.Test
{
public class ProfileModuleTests
{
[Fact]
[Fact(Skip="Removed flaky test from CI.")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void WarningOnIncompatibleVersions()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,25 @@
# limitations under the License.
# ----------------------------------------------------------------------------------

function Verify-TestRepoDeleted
{
$createdRepo = Get-PSRepository -Name "ProfileModuleTest" -ErrorAction Ignore
if($createdRepo)
{
Unregister-PSRepository -Name "ProfileModuleTest"
}
}

<#
.SYNOPSIS
Tests warning gets printed on incompatible modules with profile
#>
function Test-LoadProfileModule
{
$testPassed = $false
# Clean environment
Verify-TestRepoDeleted

# Push current profile module
Get-PackageProvider -Name NuGet -ForceBootstrap
$global:pushedProfileModule = $(Get-Module AzureRM.Profile).Path
Expand All @@ -29,15 +42,17 @@ function Test-LoadProfileModule
$global:buffer = Import-Module $global:pushedProfileModule 2>&1 3>&1 | Out-String
Write-Warning $global:buffer
Assert-True { $global:buffer -Like "*AzureRM.ApiManagement 998.9.8 is not compatible with AzureRM.Profile*" }
$testPassed = $true
} catch [system.exception] {
Write-Error $_ -ErrorAction Continue
Write-Error $_
} finally {
Uninstall-Module AzureRM.ApiManagement -ErrorAction Ignore
Uninstall-Module AzureRM.Profile -ErrorAction Ignore
}
} catch [system.exception] {
Write-Error $_ -ErrorAction Continue
Write-Error $_
} finally {
Unregister-PSRepository -Name "ProfileModuleTest"
Verify-TestRepoDeleted
}
Assert-True { $testPassed -eq $true } "testPassed = $testPassed"
}