Skip to content

Commit 11ac68a

Browse files
Skip "import az.accounts in parallel" in smoke test in ADO pipeline (#18879)
* Update RmCoreSmokeTests.ps1 * Update RmCoreSmokeTests.ps1 * Update RmCoreSmokeTests.ps1 * Update RmCoreSmokeTests.ps1 * Update tools/Test/SmokeTest/RmCoreSmokeTests.ps1 Co-authored-by: Beisi Zhou <[email protected]> Co-authored-by: Beisi Zhou <[email protected]>
1 parent 0ec5b3f commit 11ac68a

File tree

1 file changed

+24
-25
lines changed

1 file changed

+24
-25
lines changed

tools/Test/SmokeTest/RmCoreSmokeTests.ps1

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -162,36 +162,35 @@ $resourceTestCommands = @(
162162
@{Name = "Az.Websites"; Command = {Get-AzWebApp -ResourceGroupName $resourceGroupName}}
163163
)
164164

165-
# $generalCommands = @(
166-
# @{
167-
# Name = "Import Az.Accounts in Parallel";
168-
# Command = {
169-
# if ($null -ne $env:SYSTEM_DEFINITIONID) {
170-
# Write-Host "Skipping because 'Start-Job' is not supported by design in scenarios where PowerShell is being hosted in other applications."
171-
# return
172-
# }
173-
# $importJobs = @()
174-
# 1..10 | ForEach-Object {
175-
# $importJobs += Start-Job -name "import-no.$_" -ScriptBlock { Import-Module Az.Accounts; Get-AzConfig; }
176-
# }
177-
# $importJobs | Wait-Job
178-
# $importJobs | Receive-Job
179-
# $importJobs | ForEach-Object {
180-
# if ("Completed" -ne $_.State) {
181-
# throw "Some jobs have failed."
182-
# }
183-
# }
184-
# };
185-
# Retry = 0; # no need to retry
186-
# }
187-
# )
165+
$generalCommands = @(
166+
@{
167+
Name = "Import Az.Accounts in Parallel";
168+
Command = {
169+
if ($null -ne $env:SYSTEM_DEFINITIONID -or $null -ne $env:Release_DefinitionId -or $null -ne $env:AZUREPS_HOST_ENVIRONMENT) {
170+
Write-Warning "Skipping because 'Start-Job' is not supported by design in scenarios where PowerShell is being hosted in other applications."
171+
return
172+
}
173+
$importJobs = @()
174+
1..10 | ForEach-Object {
175+
$importJobs += Start-Job -name "import-no.$_" -ScriptBlock { Import-Module Az.Accounts; Get-AzConfig; }
176+
}
177+
$importJobs | Wait-Job
178+
$importJobs | Receive-Job
179+
$importJobs | ForEach-Object {
180+
if ("Completed" -ne $_.State) {
181+
throw "Some jobs have failed."
182+
}
183+
}
184+
};
185+
Retry = 0; # no need to retry
186+
}
187+
)
188188

189189
if($Reverse.IsPresent){
190190
[array]::Reverse($resourceTestCommands)
191191
}
192192

193-
#$resourceCommands=$resourceSetUpCommands+$resourceTestCommands+$resourceCleanUpCommands+$generalCommands
194-
$resourceCommands=$resourceSetUpCommands+$resourceTestCommands+$resourceCleanUpCommands
193+
$resourceCommands = $resourceSetUpCommands + $resourceTestCommands + $resourceCleanUpCommands + $generalCommands
195194

196195
$startTime = Get-Date
197196
$resourceCommands | ForEach-Object {

0 commit comments

Comments
 (0)