Skip to content

Commit

Permalink
Skip "import az.accounts in parallel" in smoke test in ADO pipeline (A…
Browse files Browse the repository at this point in the history
…zure#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]>
  • Loading branch information
isra-fel and BethanyZhou authored Jul 18, 2022
1 parent 0ec5b3f commit 11ac68a
Showing 1 changed file with 24 additions and 25 deletions.
49 changes: 24 additions & 25 deletions tools/Test/SmokeTest/RmCoreSmokeTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -162,36 +162,35 @@ $resourceTestCommands = @(
@{Name = "Az.Websites"; Command = {Get-AzWebApp -ResourceGroupName $resourceGroupName}}
)

# $generalCommands = @(
# @{
# Name = "Import Az.Accounts in Parallel";
# Command = {
# if ($null -ne $env:SYSTEM_DEFINITIONID) {
# Write-Host "Skipping because 'Start-Job' is not supported by design in scenarios where PowerShell is being hosted in other applications."
# return
# }
# $importJobs = @()
# 1..10 | ForEach-Object {
# $importJobs += Start-Job -name "import-no.$_" -ScriptBlock { Import-Module Az.Accounts; Get-AzConfig; }
# }
# $importJobs | Wait-Job
# $importJobs | Receive-Job
# $importJobs | ForEach-Object {
# if ("Completed" -ne $_.State) {
# throw "Some jobs have failed."
# }
# }
# };
# Retry = 0; # no need to retry
# }
# )
$generalCommands = @(
@{
Name = "Import Az.Accounts in Parallel";
Command = {
if ($null -ne $env:SYSTEM_DEFINITIONID -or $null -ne $env:Release_DefinitionId -or $null -ne $env:AZUREPS_HOST_ENVIRONMENT) {
Write-Warning "Skipping because 'Start-Job' is not supported by design in scenarios where PowerShell is being hosted in other applications."
return
}
$importJobs = @()
1..10 | ForEach-Object {
$importJobs += Start-Job -name "import-no.$_" -ScriptBlock { Import-Module Az.Accounts; Get-AzConfig; }
}
$importJobs | Wait-Job
$importJobs | Receive-Job
$importJobs | ForEach-Object {
if ("Completed" -ne $_.State) {
throw "Some jobs have failed."
}
}
};
Retry = 0; # no need to retry
}
)

if($Reverse.IsPresent){
[array]::Reverse($resourceTestCommands)
}

#$resourceCommands=$resourceSetUpCommands+$resourceTestCommands+$resourceCleanUpCommands+$generalCommands
$resourceCommands=$resourceSetUpCommands+$resourceTestCommands+$resourceCleanUpCommands
$resourceCommands = $resourceSetUpCommands + $resourceTestCommands + $resourceCleanUpCommands + $generalCommands

$startTime = Get-Date
$resourceCommands | ForEach-Object {
Expand Down

0 comments on commit 11ac68a

Please sign in to comment.