Skip to content

Commit fe67c72

Browse files
committed
Fix test timing out due to module scan
1 parent 365a526 commit fe67c72

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Tasks/Common/VstsAzureHelpers_/Tests/Import-AzureModule.ThrowsWhenNotFound.ps1

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@ param()
44
# Arrange.
55
. $PSScriptRoot\..\..\..\..\Tests\lib\Initialize-Test.ps1
66
$module = Microsoft.PowerShell.Core\Import-Module $PSScriptRoot\.. -PassThru
7+
Register-Mock Import-FromModulePath
8+
Register-Mock Import-FromSdkPath
9+
Register-Mock Discover-AvailableAzureModules
710
$variableSets = @(
811
@{ PreferredModule = 'Azure', 'AzureRM' }
912
@{ PreferredModule = 'Azure' }
1013
@{ PreferredModule = 'AzureRM' }
1114
)
1215
foreach ($variableSet in $variableSets) {
1316
Write-Verbose ('-' * 80)
14-
Unregister-Mock Import-FromModulePath
15-
Unregister-Mock Import-FromSdkPath
16-
Register-Mock Import-FromModulePath
17-
Register-Mock Import-FromSdkPath
1817

1918
# Act/Assert.
2019
Assert-Throws { & $module Import-AzureModule -PreferredModule $variableSet.PreferredModule -azurePsVersion "4.1.0" } -MessagePattern "AZ_ModuleNotFound 4.1.0"

0 commit comments

Comments
 (0)