From b80e0e74f9b8c08011e2628f9f0fee0a71fbbc3a Mon Sep 17 00:00:00 2001 From: lijinpei2008 Date: Tue, 19 Apr 2022 14:32:20 +0800 Subject: [PATCH 1/5] add try 3 times with 30s sleeping time --- tools/Test/SmokeTest/RmCoreSmokeTests.ps1 | 148 +++++++++++----------- 1 file changed, 74 insertions(+), 74 deletions(-) diff --git a/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 b/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 index 965ba5d1422e..162cb39f3fb6 100644 --- a/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 +++ b/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 @@ -76,90 +76,90 @@ $resourceGroupName = "azpssmokerg$randomValue" $storageAccountName = "azpssmokesa$randomValue" $resourceSetUpCommands=@( - @{Name = "Az.Resources"; Command = {New-AzResourceGroup -Name $resourceGroupName -Location westus}} + @{Name = "Az.Resources"; Command = {New-AzResourceGroup -Name $resourceGroupName -Location westus}; Retry=3; Sleep=30} ) $resourceCleanUpCommands = @( @{Name = "Az.Storage [Cleanup]"; Command = {Remove-AzStorageAccount -Name $storageAccountName -ResourceGroupName $resourceGroupName -Force}; Retry=30; Sleep=30}, - @{Name = "Az.Resources [Cleanup]"; Command = {Remove-AzResourceGroup -Name $resourceGroupName -Force}} + @{Name = "Az.Resources [Cleanup]"; Command = {Remove-AzResourceGroup -Name $resourceGroupName -Force}; Retry=3; Sleep=30} ) $resourceTestCommands = @( - @{Name = "Az.Storage [Management]"; Command = {New-AzStorageAccount -Name $storageAccountName -SkuName Standard_LRS -Location westus -ResourceGroupName $resourceGroupName}}, - @{Name = "Az.Storage [Data]"; Command = {New-AzStorageContext -StorageAccountName $storageAccountName -StorageAccountKey 12345678}}, - @{Name = "Az.Storage [Data 1]"; Command = {Get-Command Get-AzStorageBlob}}, - @{Name = "Az.Accounts"; Command = {Get-AzDomain}}, - @{Name = "Az.Accounts [DefaultProfile]"; Command = {Get-AzSubscription -DefaultProfile (Get-AzContext)}}, - @{Name = "Az.Advisor"; Command = {Get-AzAdvisorConfiguration}}, - @{Name = "Az.Aks"; Command = {Get-AzAksCluster}}, - @{Name = "Az.AnalysisServices"; Command = {Get-AzAnalysisServicesServer}}, - @{Name = "Az.ApiManagement"; Command = {Get-AzApiManagement}}, - @{Name = "Az.ApplicationInsights"; Command = {Get-AzApplicationInsights}}, - @{Name = "Az.Automation"; Command = {Get-AzAutomationAccount}}, - @{Name = "Az.Batch [MngmPlane]"; Command = {Get-AzBatchAccount}}, - @{Name = "Az.Batch [DataPlane]"; Command = {Get-Command Get-AzBatchSupportedImage}}, - @{Name = "Az.Billing"; Command = {Get-AzBillingInvoice}}, - @{Name = "Az.Billing [Consumption]"; Command = {Get-AzConsumptionBudget}}, - @{Name = "Az.Cdn"; Command = {Get-AzCdnProfile}}, - @{Name = "Az.CognitiveServices"; Command = {Get-AzCognitiveServicesAccount}}, - @{Name = "Az.Compute"; Command = {Get-AzVM}; Since="7.0.0"}, - @{Name = "Az.ContainerInstance"; Command = {Get-AzContainerGroup}}, - @{Name = "Az.ContainerRegistry [MngmPlane]"; Command = {Get-AzContainerRegistry}}, - @{Name = "Az.ContainerRegistry [DataPlane]"; Command = {Get-Command Get-AzContainerRegistryManifest}}, - @{Name = "Az.DataBoxEdge"; Command = {Get-AzDataBoxEdgeDevice -ResourceGroupName $resourceGroupName}}, - @{Name = "Az.Databricks"; Command = {Get-AzDatabricksWorkspace -ResourceGroupName $resourceGroupName}}, - @{Name = "Az.DataFactory [V1]"; Command = {Get-AzDataFactory -ResourceGroupName $resourceGroupName}}, - @{Name = "Az.DataFactoryV2 [V2]"; Command = {Get-AzDataFactoryV2}}, - @{Name = "Az.DataLakeAnalytics"; Command = {Get-AzDataLakeAnalyticsAccount}}, - @{Name = "Az.DataLakeStore [MngmPlane]"; Command = {Get-AzDataLakeStoreAccount}}, - @{Name = "Az.DataLakeStore [DataPlane]"; Command = {Get-Command New-AzDataLakeStoreItem}}, - @{Name = "Az.DataShare"; Command = {Get-AzDataShareAccount -ResourceGroupName $resourceGroupName}}, + @{Name = "Az.Storage [Management]"; Command = {New-AzStorageAccount -Name $storageAccountName -SkuName Standard_LRS -Location westus -ResourceGroupName $resourceGroupName}; Retry=3; Sleep=30}, + @{Name = "Az.Storage [Data]"; Command = {New-AzStorageContext -StorageAccountName $storageAccountName -StorageAccountKey 12345678}; Retry=3; Sleep=30}, + @{Name = "Az.Storage [Data 1]"; Command = {Get-Command Get-AzStorageBlob}; Retry=3; Sleep=30}, + @{Name = "Az.Accounts"; Command = {Get-AzDomain}; Retry=3; Sleep=30}, + @{Name = "Az.Accounts [DefaultProfile]"; Command = {Get-AzSubscription -DefaultProfile (Get-AzContext)}; Retry=3; Sleep=30}, + @{Name = "Az.Advisor"; Command = {Get-AzAdvisorConfiguration}; Retry=3; Sleep=30}, + @{Name = "Az.Aks"; Command = {Get-AzAksCluster}; Retry=3; Sleep=30}, + @{Name = "Az.AnalysisServices"; Command = {Get-AzAnalysisServicesServer}; Retry=3; Sleep=30}, + @{Name = "Az.ApiManagement"; Command = {Get-AzApiManagement}; Retry=3; Sleep=30}, + @{Name = "Az.ApplicationInsights"; Command = {Get-AzApplicationInsights}; Retry=3; Sleep=30}, + @{Name = "Az.Automation"; Command = {Get-AzAutomationAccount}; Retry=3; Sleep=30}, + @{Name = "Az.Batch [MngmPlane]"; Command = {Get-AzBatchAccount}; Retry=3; Sleep=30}, + @{Name = "Az.Batch [DataPlane]"; Command = {Get-Command Get-AzBatchSupportedImage}; Retry=3; Sleep=30}, + @{Name = "Az.Billing"; Command = {Get-AzBillingInvoice}; Retry=3; Sleep=30}, + @{Name = "Az.Billing [Consumption]"; Command = {Get-AzConsumptionBudget}; Retry=3; Sleep=30}, + @{Name = "Az.Cdn"; Command = {Get-AzCdnProfile}; Retry=3; Sleep=30}, + @{Name = "Az.CognitiveServices"; Command = {Get-AzCognitiveServicesAccount}; Retry=3; Sleep=30}, + @{Name = "Az.Compute"; Command = {Get-AzVM}; Retry=3; Sleep=30; Since="7.0.0"}, + @{Name = "Az.ContainerInstance"; Command = {Get-AzContainerGroup}; Retry=3; Sleep=30}, + @{Name = "Az.ContainerRegistry [MngmPlane]"; Command = {Get-AzContainerRegistry}; Retry=3; Sleep=30}, + @{Name = "Az.ContainerRegistry [DataPlane]"; Command = {Get-Command Get-AzContainerRegistryManifest}; Retry=3; Sleep=30}, + @{Name = "Az.DataBoxEdge"; Command = {Get-AzDataBoxEdgeDevice -ResourceGroupName $resourceGroupName}; Retry=3; Sleep=30}, + @{Name = "Az.Databricks"; Command = {Get-AzDatabricksWorkspace -ResourceGroupName $resourceGroupName}; Retry=3; Sleep=30}, + @{Name = "Az.DataFactory [V1]"; Command = {Get-AzDataFactory -ResourceGroupName $resourceGroupName}; Retry=3; Sleep=30}, + @{Name = "Az.DataFactoryV2 [V2]"; Command = {Get-AzDataFactoryV2}; Retry=3; Sleep=30}, + @{Name = "Az.DataLakeAnalytics"; Command = {Get-AzDataLakeAnalyticsAccount}; Retry=3; Sleep=30}, + @{Name = "Az.DataLakeStore [MngmPlane]"; Command = {Get-AzDataLakeStoreAccount}; Retry=3; Sleep=30}, + @{Name = "Az.DataLakeStore [DataPlane]"; Command = {Get-Command New-AzDataLakeStoreItem}; Retry=3; Sleep=30}, + @{Name = "Az.DataShare"; Command = {Get-AzDataShareAccount -ResourceGroupName $resourceGroupName}; Retry=3; Sleep=30}, # Waiting for an issue fix: https://github.com/Azure/azure-powershell/issues/13522#issuecomment-728659457 # @{Name = "Az.DeploymentManager"; Command = {try {Get-AzDeploymentManagerArtifactSource -ResourceGroupName $resourceGroupName }catch {if ($_.ToString() -notlike "*not found*") {throw $_}}}}, - @{Name = "Az.DesktopVirtualization"; Command = {Get-AzWvdApplicationGroup -ResourceGroupName $resourceGroupName}}, - @{Name = "Az.Dns"; Command = {Get-AzDnsZone}}, - @{Name = "Az.EventGrid"; Command = {Get-AzEventGridTopic}}, - @{Name = "Az.EventHub"; Command = {Get-AzEventHubNamespace}}, - @{Name = "Az.FrontDoor"; Command = {Get-AzFrontDoor}}, - @{Name = "Az.Functions"; Command = {Get-AzFunctionApp}}, - @{Name = "Az.HDInsight "; Command = {Get-AzHDInsightCluster}}, - @{Name = "Az.HealthcareApis"; Command = {Get-AzHealthcareApisService}}, - @{Name = "Az.IotHub [MngmPlane]"; Command = {Get-AzIotHub}}, - @{Name = "Az.IotHub [DataPlane]"; Command = {Get-Command Get-AzIotHubModuleConnectionString}}, - @{Name = "Az.KeyVault [MngmPlane]"; Command = {Get-AzKeyVault}}, - @{Name = "Az.KeyVault [DataPlane]"; Command = {Get-Command Get-AzKeyVaultKey}}, - @{Name = "Az.Kusto"; Command = {Get-AzKustoCluster}}, - @{Name = "Az.LogicApp"; Command = {Get-AzIntegrationAccount}}, - @{Name = "Az.MachineLearning"; Command = {Get-AzMlWebService}}, + @{Name = "Az.DesktopVirtualization"; Command = {Get-AzWvdApplicationGroup -ResourceGroupName $resourceGroupName}; Retry=3; Sleep=30}, + @{Name = "Az.Dns"; Command = {Get-AzDnsZone}; Retry=3; Sleep=30}, + @{Name = "Az.EventGrid"; Command = {Get-AzEventGridTopic}; Retry=3; Sleep=30}, + @{Name = "Az.EventHub"; Command = {Get-AzEventHubNamespace}; Retry=3; Sleep=30}, + @{Name = "Az.FrontDoor"; Command = {Get-AzFrontDoor}; Retry=3; Sleep=30}, + @{Name = "Az.Functions"; Command = {Get-AzFunctionApp}; Retry=3; Sleep=30}, + @{Name = "Az.HDInsight "; Command = {Get-AzHDInsightCluster}; Retry=3; Sleep=30}, + @{Name = "Az.HealthcareApis"; Command = {Get-AzHealthcareApisService}; Retry=3; Sleep=30}, + @{Name = "Az.IotHub [MngmPlane]"; Command = {Get-AzIotHub}; Retry=3; Sleep=30}, + @{Name = "Az.IotHub [DataPlane]"; Command = {Get-Command Get-AzIotHubModuleConnectionString}; Retry=3; Sleep=30}, + @{Name = "Az.KeyVault [MngmPlane]"; Command = {Get-AzKeyVault}; Retry=3; Sleep=30}, + @{Name = "Az.KeyVault [DataPlane]"; Command = {Get-Command Get-AzKeyVaultKey}; Retry=3; Sleep=30}, + @{Name = "Az.Kusto"; Command = {Get-AzKustoCluster}; Retry=3; Sleep=30}, + @{Name = "Az.LogicApp"; Command = {Get-AzIntegrationAccount}; Retry=3; Sleep=30}, + @{Name = "Az.MachineLearning"; Command = {Get-AzMlWebService}; Retry=3; Sleep=30}, @{Name = "Az.Maintenance"; Command = {Get-AzMaintenanceConfiguration}; Retry=30; Sleep=30}, - @{Name = "Az.ManagedServices"; Command = {Get-AzManagedServicesAssignment}}, - @{Name = "Az.Media"; Command = {Get-AzMediaService -ResourceGroupName $resourceGroupName}}, - @{Name = "Az.Monitor"; Command = {Get-AzLogProfile}}, - @{Name = "Az.Network"; Command = {Get-AzNetworkInterface}}, - @{Name = "Az.NotificationHubs"; Command = {Get-AzNotificationHubsNamespace}}, - @{Name = "Az.OperationalInsights [MngmPlane]"; Command = {Get-AzOperationalInsightsWorkspace}}, - @{Name = "Az.OperationalInsights [DataPlane]"; Command = {Get-Command Invoke-AzOperationalInsightsQuery}}, - @{Name = "Az.PolicyInsights"; Command = {Get-AzPolicyEvent -Top 10}}, # without -Top service may return 400: ResponseTooLarge - @{Name = "Az.PowerBIEmbedded"; Command = {Get-AzPowerBIEmbeddedCapacity}}, - @{Name = "Az.PowerBIUEmbedded"; Command = {Get-AzPowerBIWorkspaceCollection}}, - @{Name = "Az.PrivateDns"; Command = {Get-AzPrivateDnsZone}}, - @{Name = "Az.RecoveryServices"; Command = {Get-AzRecoveryServicesVault}}, - @{Name = "Az.RedisCache"; Command = {Get-AzRedisCache}}, - @{Name = "Az.Relay"; Command = {Get-AzRelayNamespace}}, - @{Name = "Az.ServiceBus"; Command = {Get-AzServiceBusNamespace}}, - @{Name = "Az.ServiceFabric [MngmPlane]"; Command = {Get-AzServiceFabricCluster}}, - @{Name = "Az.ServiceFabric [DataPlane]"; Command = {Get-Command New-AzServiceFabricCluster}}, - @{Name = "Az.SignalR"; Command = {Get-AzSignalR}}, - @{Name = "Az.Sql"; Command = {Get-AzSqlServer}}, - @{Name = "Az.SqlVirtualMachine"; Command = {Get-AzSqlVM}}, - @{Name = "Az.StreamAnalytics"; Command = {Get-AzStreamAnalyticsJob}}, - @{Name = "Az.StorageSync"; Command = {Get-AzStorageSyncService}}, - @{Name = "Az.Support"; Command = {Get-AzSupportTicket}}, - @{Name = "Az.Resources [Tags]"; Command = {Get-AzTag}}, - @{Name = "Az.Resources [MSGraph]"; Command = {Get-AzAdGroup -First 1}}, - @{Name = "Az.TrafficManager"; Command = {Get-AzTrafficManagerProfile}}, - @{Name = "Az.Billing [UsageAggregates]"; Command = {Get-UsageAggregates -ReportedStartTime '1/1/2018' -ReportedEndTime '1/2/2018'}}, - @{Name = "Az.Websites"; Command = {Get-AzWebApp -ResourceGroupName $resourceGroupName}} + @{Name = "Az.ManagedServices"; Command = {Get-AzManagedServicesAssignment}; Retry=3; Sleep=30}, + @{Name = "Az.Media"; Command = {Get-AzMediaService -ResourceGroupName $resourceGroupName}; Retry=3; Sleep=30}, + @{Name = "Az.Monitor"; Command = {Get-AzLogProfile}; Retry=3; Sleep=30}, + @{Name = "Az.Network"; Command = {Get-AzNetworkInterface}; Retry=3; Sleep=30}, + @{Name = "Az.NotificationHubs"; Command = {Get-AzNotificationHubsNamespace}; Retry=3; Sleep=30}, + @{Name = "Az.OperationalInsights [MngmPlane]"; Command = {Get-AzOperationalInsightsWorkspace}; Retry=3; Sleep=30}, + @{Name = "Az.OperationalInsights [DataPlane]"; Command = {Get-Command Invoke-AzOperationalInsightsQuery}; Retry=3; Sleep=30}, + @{Name = "Az.PolicyInsights"; Command = {Get-AzPolicyEvent -Top 10}; Retry=3; Sleep=30}, # without -Top service may return 400: ResponseTooLarge + @{Name = "Az.PowerBIEmbedded"; Command = {Get-AzPowerBIEmbeddedCapacity}; Retry=3; Sleep=30}, + @{Name = "Az.PowerBIUEmbedded"; Command = {Get-AzPowerBIWorkspaceCollection}; Retry=3; Sleep=30}, + @{Name = "Az.PrivateDns"; Command = {Get-AzPrivateDnsZone}; Retry=3; Sleep=30}, + @{Name = "Az.RecoveryServices"; Command = {Get-AzRecoveryServicesVault}; Retry=3; Sleep=30}, + @{Name = "Az.RedisCache"; Command = {Get-AzRedisCache}; Retry=3; Sleep=30}, + @{Name = "Az.Relay"; Command = {Get-AzRelayNamespace}; Retry=3; Sleep=30}, + @{Name = "Az.ServiceBus"; Command = {Get-AzServiceBusNamespace}; Retry=3; Sleep=30}, + @{Name = "Az.ServiceFabric [MngmPlane]"; Command = {Get-AzServiceFabricCluster}; Retry=3; Sleep=30}, + @{Name = "Az.ServiceFabric [DataPlane]"; Command = {Get-Command New-AzServiceFabricCluster}; Retry=3; Sleep=30}, + @{Name = "Az.SignalR"; Command = {Get-AzSignalR}; Retry=3; Sleep=30}, + @{Name = "Az.Sql"; Command = {Get-AzSqlServer}; Retry=3; Sleep=30}, + @{Name = "Az.SqlVirtualMachine"; Command = {Get-AzSqlVM}; Retry=3; Sleep=30}, + @{Name = "Az.StreamAnalytics"; Command = {Get-AzStreamAnalyticsJob}; Retry=3; Sleep=30}, + @{Name = "Az.StorageSync"; Command = {Get-AzStorageSyncService}; Retry=3; Sleep=30}, + @{Name = "Az.Support"; Command = {Get-AzSupportTicket}; Retry=3; Sleep=30}, + @{Name = "Az.Resources [Tags]"; Command = {Get-AzTag}; Retry=3; Sleep=30}, + @{Name = "Az.Resources [MSGraph]"; Command = {Get-AzAdGroup -First 1}; Retry=3; Sleep=30}, + @{Name = "Az.TrafficManager"; Command = {Get-AzTrafficManagerProfile}; Retry=3; Sleep=30}, + @{Name = "Az.Billing [UsageAggregates]"; Command = {Get-UsageAggregates -ReportedStartTime '1/1/2018' -ReportedEndTime '1/2/2018'}; Retry=3; Sleep=30}, + @{Name = "Az.Websites"; Command = {Get-AzWebApp -ResourceGroupName $resourceGroupName}; Retry=3; Sleep=30} ) if($Reverse.IsPresent){ From abf9a4b7efde4f6db90464c9952e50198f53dd80 Mon Sep 17 00:00:00 2001 From: lijinpei2008 Date: Tue, 19 Apr 2022 14:41:34 +0800 Subject: [PATCH 2/5] add try 3 times with 30s sleeping time --- tools/Test/SmokeTest/RmCoreSmokeTests.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 b/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 index 162cb39f3fb6..3681744d4f29 100644 --- a/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 +++ b/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 @@ -172,8 +172,8 @@ $startTime = Get-Date $resourceCommands | ForEach-Object { $testName = $_.Name $script = $_.Command - $retry = if($null -eq $_.retry) {0} Else {$_.retry} - $sleep = if($null -eq $_.sleep) {30} Else {$_.sleep} + $retry = if($null -eq $_.Retry) {0} Else {$_.Retry} + $sleep = if($null -eq $_.Sleep) {30} Else {$_.Sleep} if($null -ne $_.Since -and "Core" -eq $PSVersionTable.PSEdition -and $PSVersionTable.PSVersion -lt [System.Version]$_.Since) { Write-Output "Skip test $testName" $testInfo.SkippedCount += 1 From 5ea996ee118e08ec1762192efa1258aae4ae1020 Mon Sep 17 00:00:00 2001 From: lijinpei2008 Date: Tue, 26 Apr 2022 14:03:20 +0800 Subject: [PATCH 3/5] print error message and format code --- tools/Test/SmokeTest/RmCoreSmokeTests.ps1 | 156 +++++++++++----------- 1 file changed, 78 insertions(+), 78 deletions(-) diff --git a/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 b/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 index 3681744d4f29..ff2f599cccd6 100644 --- a/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 +++ b/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 @@ -52,7 +52,7 @@ function Retry-AzCommand { $loopLimit = 0 do { try { - $script = "`$ErrorActionPreference='Stop' `n" + $script = if($loopLimit -gt 0) {"`$ErrorActionPreference='Continue' `n"} Else {"`$ErrorActionPreference='Stop' `n"} $script += $Command.ToString() &([ScriptBlock]::Create($script)) break @@ -76,90 +76,90 @@ $resourceGroupName = "azpssmokerg$randomValue" $storageAccountName = "azpssmokesa$randomValue" $resourceSetUpCommands=@( - @{Name = "Az.Resources"; Command = {New-AzResourceGroup -Name $resourceGroupName -Location westus}; Retry=3; Sleep=30} + @{Name = "Az.Resources"; Command = {New-AzResourceGroup -Name $resourceGroupName -Location westus}} ) $resourceCleanUpCommands = @( - @{Name = "Az.Storage [Cleanup]"; Command = {Remove-AzStorageAccount -Name $storageAccountName -ResourceGroupName $resourceGroupName -Force}; Retry=30; Sleep=30}, - @{Name = "Az.Resources [Cleanup]"; Command = {Remove-AzResourceGroup -Name $resourceGroupName -Force}; Retry=3; Sleep=30} + @{Name = "Az.Storage [Cleanup]"; Command = {Remove-AzStorageAccount -Name $storageAccountName -ResourceGroupName $resourceGroupName -Force}}, + @{Name = "Az.Resources [Cleanup]"; Command = {Remove-AzResourceGroup -Name $resourceGroupName -Force}} ) $resourceTestCommands = @( - @{Name = "Az.Storage [Management]"; Command = {New-AzStorageAccount -Name $storageAccountName -SkuName Standard_LRS -Location westus -ResourceGroupName $resourceGroupName}; Retry=3; Sleep=30}, - @{Name = "Az.Storage [Data]"; Command = {New-AzStorageContext -StorageAccountName $storageAccountName -StorageAccountKey 12345678}; Retry=3; Sleep=30}, - @{Name = "Az.Storage [Data 1]"; Command = {Get-Command Get-AzStorageBlob}; Retry=3; Sleep=30}, - @{Name = "Az.Accounts"; Command = {Get-AzDomain}; Retry=3; Sleep=30}, - @{Name = "Az.Accounts [DefaultProfile]"; Command = {Get-AzSubscription -DefaultProfile (Get-AzContext)}; Retry=3; Sleep=30}, - @{Name = "Az.Advisor"; Command = {Get-AzAdvisorConfiguration}; Retry=3; Sleep=30}, - @{Name = "Az.Aks"; Command = {Get-AzAksCluster}; Retry=3; Sleep=30}, - @{Name = "Az.AnalysisServices"; Command = {Get-AzAnalysisServicesServer}; Retry=3; Sleep=30}, - @{Name = "Az.ApiManagement"; Command = {Get-AzApiManagement}; Retry=3; Sleep=30}, - @{Name = "Az.ApplicationInsights"; Command = {Get-AzApplicationInsights}; Retry=3; Sleep=30}, - @{Name = "Az.Automation"; Command = {Get-AzAutomationAccount}; Retry=3; Sleep=30}, - @{Name = "Az.Batch [MngmPlane]"; Command = {Get-AzBatchAccount}; Retry=3; Sleep=30}, - @{Name = "Az.Batch [DataPlane]"; Command = {Get-Command Get-AzBatchSupportedImage}; Retry=3; Sleep=30}, - @{Name = "Az.Billing"; Command = {Get-AzBillingInvoice}; Retry=3; Sleep=30}, - @{Name = "Az.Billing [Consumption]"; Command = {Get-AzConsumptionBudget}; Retry=3; Sleep=30}, - @{Name = "Az.Cdn"; Command = {Get-AzCdnProfile}; Retry=3; Sleep=30}, - @{Name = "Az.CognitiveServices"; Command = {Get-AzCognitiveServicesAccount}; Retry=3; Sleep=30}, - @{Name = "Az.Compute"; Command = {Get-AzVM}; Retry=3; Sleep=30; Since="7.0.0"}, - @{Name = "Az.ContainerInstance"; Command = {Get-AzContainerGroup}; Retry=3; Sleep=30}, - @{Name = "Az.ContainerRegistry [MngmPlane]"; Command = {Get-AzContainerRegistry}; Retry=3; Sleep=30}, - @{Name = "Az.ContainerRegistry [DataPlane]"; Command = {Get-Command Get-AzContainerRegistryManifest}; Retry=3; Sleep=30}, - @{Name = "Az.DataBoxEdge"; Command = {Get-AzDataBoxEdgeDevice -ResourceGroupName $resourceGroupName}; Retry=3; Sleep=30}, - @{Name = "Az.Databricks"; Command = {Get-AzDatabricksWorkspace -ResourceGroupName $resourceGroupName}; Retry=3; Sleep=30}, - @{Name = "Az.DataFactory [V1]"; Command = {Get-AzDataFactory -ResourceGroupName $resourceGroupName}; Retry=3; Sleep=30}, - @{Name = "Az.DataFactoryV2 [V2]"; Command = {Get-AzDataFactoryV2}; Retry=3; Sleep=30}, - @{Name = "Az.DataLakeAnalytics"; Command = {Get-AzDataLakeAnalyticsAccount}; Retry=3; Sleep=30}, - @{Name = "Az.DataLakeStore [MngmPlane]"; Command = {Get-AzDataLakeStoreAccount}; Retry=3; Sleep=30}, - @{Name = "Az.DataLakeStore [DataPlane]"; Command = {Get-Command New-AzDataLakeStoreItem}; Retry=3; Sleep=30}, - @{Name = "Az.DataShare"; Command = {Get-AzDataShareAccount -ResourceGroupName $resourceGroupName}; Retry=3; Sleep=30}, + @{Name = "Az.Storage [Management]"; Command = {New-AzStorageAccount -Name $storageAccountName -SkuName Standard_LRS -Location westus -ResourceGroupName $resourceGroupName}}, + @{Name = "Az.Storage [Data]"; Command = {New-AzStorageContext -StorageAccountName $storageAccountName -StorageAccountKey 12345678}}, + @{Name = "Az.Storage [Data 1]"; Command = {Get-Command Get-AzStorageBlob}}, + @{Name = "Az.Accounts"; Command = {Get-AzDomain}}, + @{Name = "Az.Accounts [DefaultProfile]"; Command = {Get-AzSubscription -DefaultProfile (Get-AzContext)}}, + @{Name = "Az.Advisor"; Command = {Get-AzAdvisorConfiguration}}, + @{Name = "Az.Aks"; Command = {Get-AzAksCluster}}, + @{Name = "Az.AnalysisServices"; Command = {Get-AzAnalysisServicesServer}}, + @{Name = "Az.ApiManagement"; Command = {Get-AzApiManagement}}, + @{Name = "Az.ApplicationInsights"; Command = {Get-AzApplicationInsights}}, + @{Name = "Az.Automation"; Command = {Get-AzAutomationAccount}}, + @{Name = "Az.Batch [MngmPlane]"; Command = {Get-AzBatchAccount}}, + @{Name = "Az.Batch [DataPlane]"; Command = {Get-Command Get-AzBatchSupportedImage}}, + @{Name = "Az.Billing"; Command = {Get-AzBillingInvoice}}, + @{Name = "Az.Billing [Consumption]"; Command = {Get-AzConsumptionBudget}}, + @{Name = "Az.Cdn"; Command = {Get-AzCdnProfile}}, + @{Name = "Az.CognitiveServices"; Command = {Get-AzCognitiveServicesAccount}}, + @{Name = "Az.Compute"; Command = {Get-AzVM}; Since="7.0.0"}, + @{Name = "Az.ContainerInstance"; Command = {Get-AzContainerGroup}}, + @{Name = "Az.ContainerRegistry [MngmPlane]"; Command = {Get-AzContainerRegistry}}, + @{Name = "Az.ContainerRegistry [DataPlane]"; Command = {Get-Command Get-AzContainerRegistryManifest}}, + @{Name = "Az.DataBoxEdge"; Command = {Get-AzDataBoxEdgeDevice -ResourceGroupName $resourceGroupName}}, + @{Name = "Az.Databricks"; Command = {Get-AzDatabricksWorkspace -ResourceGroupName $resourceGroupName}}, + @{Name = "Az.DataFactory [V1]"; Command = {Get-AzDataFactory -ResourceGroupName $resourceGroupName}}, + @{Name = "Az.DataFactoryV2 [V2]"; Command = {Get-AzDataFactoryV2}}, + @{Name = "Az.DataLakeAnalytics"; Command = {Get-AzDataLakeAnalyticsAccount}}, + @{Name = "Az.DataLakeStore [MngmPlane]"; Command = {Get-AzDataLakeStoreAccount}}, + @{Name = "Az.DataLakeStore [DataPlane]"; Command = {Get-Command New-AzDataLakeStoreItem}}, + @{Name = "Az.DataShare"; Command = {Get-AzDataShareAccount -ResourceGroupName $resourceGroupName}}, # Waiting for an issue fix: https://github.com/Azure/azure-powershell/issues/13522#issuecomment-728659457 # @{Name = "Az.DeploymentManager"; Command = {try {Get-AzDeploymentManagerArtifactSource -ResourceGroupName $resourceGroupName }catch {if ($_.ToString() -notlike "*not found*") {throw $_}}}}, - @{Name = "Az.DesktopVirtualization"; Command = {Get-AzWvdApplicationGroup -ResourceGroupName $resourceGroupName}; Retry=3; Sleep=30}, - @{Name = "Az.Dns"; Command = {Get-AzDnsZone}; Retry=3; Sleep=30}, - @{Name = "Az.EventGrid"; Command = {Get-AzEventGridTopic}; Retry=3; Sleep=30}, - @{Name = "Az.EventHub"; Command = {Get-AzEventHubNamespace}; Retry=3; Sleep=30}, - @{Name = "Az.FrontDoor"; Command = {Get-AzFrontDoor}; Retry=3; Sleep=30}, - @{Name = "Az.Functions"; Command = {Get-AzFunctionApp}; Retry=3; Sleep=30}, - @{Name = "Az.HDInsight "; Command = {Get-AzHDInsightCluster}; Retry=3; Sleep=30}, - @{Name = "Az.HealthcareApis"; Command = {Get-AzHealthcareApisService}; Retry=3; Sleep=30}, - @{Name = "Az.IotHub [MngmPlane]"; Command = {Get-AzIotHub}; Retry=3; Sleep=30}, - @{Name = "Az.IotHub [DataPlane]"; Command = {Get-Command Get-AzIotHubModuleConnectionString}; Retry=3; Sleep=30}, - @{Name = "Az.KeyVault [MngmPlane]"; Command = {Get-AzKeyVault}; Retry=3; Sleep=30}, - @{Name = "Az.KeyVault [DataPlane]"; Command = {Get-Command Get-AzKeyVaultKey}; Retry=3; Sleep=30}, - @{Name = "Az.Kusto"; Command = {Get-AzKustoCluster}; Retry=3; Sleep=30}, - @{Name = "Az.LogicApp"; Command = {Get-AzIntegrationAccount}; Retry=3; Sleep=30}, - @{Name = "Az.MachineLearning"; Command = {Get-AzMlWebService}; Retry=3; Sleep=30}, - @{Name = "Az.Maintenance"; Command = {Get-AzMaintenanceConfiguration}; Retry=30; Sleep=30}, - @{Name = "Az.ManagedServices"; Command = {Get-AzManagedServicesAssignment}; Retry=3; Sleep=30}, - @{Name = "Az.Media"; Command = {Get-AzMediaService -ResourceGroupName $resourceGroupName}; Retry=3; Sleep=30}, - @{Name = "Az.Monitor"; Command = {Get-AzLogProfile}; Retry=3; Sleep=30}, - @{Name = "Az.Network"; Command = {Get-AzNetworkInterface}; Retry=3; Sleep=30}, - @{Name = "Az.NotificationHubs"; Command = {Get-AzNotificationHubsNamespace}; Retry=3; Sleep=30}, - @{Name = "Az.OperationalInsights [MngmPlane]"; Command = {Get-AzOperationalInsightsWorkspace}; Retry=3; Sleep=30}, - @{Name = "Az.OperationalInsights [DataPlane]"; Command = {Get-Command Invoke-AzOperationalInsightsQuery}; Retry=3; Sleep=30}, - @{Name = "Az.PolicyInsights"; Command = {Get-AzPolicyEvent -Top 10}; Retry=3; Sleep=30}, # without -Top service may return 400: ResponseTooLarge - @{Name = "Az.PowerBIEmbedded"; Command = {Get-AzPowerBIEmbeddedCapacity}; Retry=3; Sleep=30}, - @{Name = "Az.PowerBIUEmbedded"; Command = {Get-AzPowerBIWorkspaceCollection}; Retry=3; Sleep=30}, - @{Name = "Az.PrivateDns"; Command = {Get-AzPrivateDnsZone}; Retry=3; Sleep=30}, - @{Name = "Az.RecoveryServices"; Command = {Get-AzRecoveryServicesVault}; Retry=3; Sleep=30}, - @{Name = "Az.RedisCache"; Command = {Get-AzRedisCache}; Retry=3; Sleep=30}, - @{Name = "Az.Relay"; Command = {Get-AzRelayNamespace}; Retry=3; Sleep=30}, - @{Name = "Az.ServiceBus"; Command = {Get-AzServiceBusNamespace}; Retry=3; Sleep=30}, - @{Name = "Az.ServiceFabric [MngmPlane]"; Command = {Get-AzServiceFabricCluster}; Retry=3; Sleep=30}, - @{Name = "Az.ServiceFabric [DataPlane]"; Command = {Get-Command New-AzServiceFabricCluster}; Retry=3; Sleep=30}, - @{Name = "Az.SignalR"; Command = {Get-AzSignalR}; Retry=3; Sleep=30}, - @{Name = "Az.Sql"; Command = {Get-AzSqlServer}; Retry=3; Sleep=30}, - @{Name = "Az.SqlVirtualMachine"; Command = {Get-AzSqlVM}; Retry=3; Sleep=30}, - @{Name = "Az.StreamAnalytics"; Command = {Get-AzStreamAnalyticsJob}; Retry=3; Sleep=30}, - @{Name = "Az.StorageSync"; Command = {Get-AzStorageSyncService}; Retry=3; Sleep=30}, - @{Name = "Az.Support"; Command = {Get-AzSupportTicket}; Retry=3; Sleep=30}, - @{Name = "Az.Resources [Tags]"; Command = {Get-AzTag}; Retry=3; Sleep=30}, - @{Name = "Az.Resources [MSGraph]"; Command = {Get-AzAdGroup -First 1}; Retry=3; Sleep=30}, - @{Name = "Az.TrafficManager"; Command = {Get-AzTrafficManagerProfile}; Retry=3; Sleep=30}, - @{Name = "Az.Billing [UsageAggregates]"; Command = {Get-UsageAggregates -ReportedStartTime '1/1/2018' -ReportedEndTime '1/2/2018'}; Retry=3; Sleep=30}, - @{Name = "Az.Websites"; Command = {Get-AzWebApp -ResourceGroupName $resourceGroupName}; Retry=3; Sleep=30} + @{Name = "Az.DesktopVirtualization"; Command = {Get-AzWvdApplicationGroup -ResourceGroupName $resourceGroupName}}, + @{Name = "Az.Dns"; Command = {Get-AzDnsZone}}, + @{Name = "Az.EventGrid"; Command = {Get-AzEventGridTopic}}, + @{Name = "Az.EventHub"; Command = {Get-AzEventHubNamespace}}, + @{Name = "Az.FrontDoor"; Command = {Get-AzFrontDoor}}, + @{Name = "Az.Functions"; Command = {Get-AzFunctionApp}}, + @{Name = "Az.HDInsight "; Command = {Get-AzHDInsightCluster}}, + @{Name = "Az.HealthcareApis"; Command = {Get-AzHealthcareApisService}}, + @{Name = "Az.IotHub [MngmPlane]"; Command = {Get-AzIotHub}}, + @{Name = "Az.IotHub [DataPlane]"; Command = {Get-Command Get-AzIotHubModuleConnectionString}}, + @{Name = "Az.KeyVault [MngmPlane]"; Command = {Get-AzKeyVault}}, + @{Name = "Az.KeyVault [DataPlane]"; Command = {Get-Command Get-AzKeyVaultKey}}, + @{Name = "Az.Kusto"; Command = {Get-AzKustoCluster}}, + @{Name = "Az.LogicApp"; Command = {Get-AzIntegrationAccount}}, + @{Name = "Az.MachineLearning"; Command = {Get-AzMlWebService}}, + @{Name = "Az.Maintenance"; Command = {Get-AzMaintenanceConfiguration}}, + @{Name = "Az.ManagedServices"; Command = {Get-AzManagedServicesAssignment}}, + @{Name = "Az.Media"; Command = {Get-AzMediaService -ResourceGroupName $resourceGroupName}}, + @{Name = "Az.Monitor"; Command = {Get-AzLogProfile}}, + @{Name = "Az.Network"; Command = {Get-AzNetworkInterface}}, + @{Name = "Az.NotificationHubs"; Command = {Get-AzNotificationHubsNamespace}}, + @{Name = "Az.OperationalInsights [MngmPlane]"; Command = {Get-AzOperationalInsightsWorkspace}}, + @{Name = "Az.OperationalInsights [DataPlane]"; Command = {Get-Command Invoke-AzOperationalInsightsQuery}}, + @{Name = "Az.PolicyInsights"; Command = {Get-AzPolicyEvent -Top 10}}, # without -Top service may return 400: ResponseTooLarge + @{Name = "Az.PowerBIEmbedded"; Command = {Get-AzPowerBIEmbeddedCapacity}}, + @{Name = "Az.PowerBIUEmbedded"; Command = {Get-AzPowerBIWorkspaceCollection}}, + @{Name = "Az.PrivateDns"; Command = {Get-AzPrivateDnsZone}}, + @{Name = "Az.RecoveryServices"; Command = {Get-AzRecoveryServicesVault}}, + @{Name = "Az.RedisCache"; Command = {Get-AzRedisCache}}, + @{Name = "Az.Relay"; Command = {Get-AzRelayNamespace}}, + @{Name = "Az.ServiceBus"; Command = {Get-AzServiceBusNamespace}}, + @{Name = "Az.ServiceFabric [MngmPlane]"; Command = {Get-AzServiceFabricCluster}}, + @{Name = "Az.ServiceFabric [DataPlane]"; Command = {Get-Command New-AzServiceFabricCluster}}, + @{Name = "Az.SignalR"; Command = {Get-AzSignalR}}, + @{Name = "Az.Sql"; Command = {Get-AzSqlServer}}, + @{Name = "Az.SqlVirtualMachine"; Command = {Get-AzSqlVM}}, + @{Name = "Az.StreamAnalytics"; Command = {Get-AzStreamAnalyticsJob}}, + @{Name = "Az.StorageSync"; Command = {Get-AzStorageSyncService}}, + @{Name = "Az.Support"; Command = {Get-AzSupportTicket}}, + @{Name = "Az.Resources [Tags]"; Command = {Get-AzTag}}, + @{Name = "Az.Resources [MSGraph]"; Command = {Get-AzAdGroup -First 1}}, + @{Name = "Az.TrafficManager"; Command = {Get-AzTrafficManagerProfile}}, + @{Name = "Az.Billing [UsageAggregates]"; Command = {Get-UsageAggregates -ReportedStartTime '1/1/2018' -ReportedEndTime '1/2/2018'}}, + @{Name = "Az.Websites"; Command = {Get-AzWebApp -ResourceGroupName $resourceGroupName}} ) if($Reverse.IsPresent){ @@ -172,7 +172,7 @@ $startTime = Get-Date $resourceCommands | ForEach-Object { $testName = $_.Name $script = $_.Command - $retry = if($null -eq $_.Retry) {0} Else {$_.Retry} + $retry = if($null -eq $_.Retry) {3} Else {$_.Retry} $sleep = if($null -eq $_.Sleep) {30} Else {$_.Sleep} if($null -ne $_.Since -and "Core" -eq $PSVersionTable.PSEdition -and $PSVersionTable.PSVersion -lt [System.Version]$_.Since) { Write-Output "Skip test $testName" From 6e8675f9fcff821e311176fcf20321935a1954a1 Mon Sep 17 00:00:00 2001 From: lijinpei2008 Date: Tue, 26 Apr 2022 14:06:55 +0800 Subject: [PATCH 4/5] print error message and format code --- tools/Test/SmokeTest/RmCoreSmokeTests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 b/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 index ff2f599cccd6..37770d9fe82e 100644 --- a/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 +++ b/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 @@ -52,7 +52,7 @@ function Retry-AzCommand { $loopLimit = 0 do { try { - $script = if($loopLimit -gt 0) {"`$ErrorActionPreference='Continue' `n"} Else {"`$ErrorActionPreference='Stop' `n"} + $script = if($loopLimit -gt 0) {"`$ErrorActionPreference='Continue' `n"} Else {"`$ErrorActionPreference='SilentlyContinue' `n"} $script += $Command.ToString() &([ScriptBlock]::Create($script)) break From 1c766e865524843e1365b6cac26aaf6aeee34a9b Mon Sep 17 00:00:00 2001 From: lijinpei2008 Date: Thu, 28 Apr 2022 12:01:12 +0800 Subject: [PATCH 5/5] update erroractionpreference's value --- tools/Test/SmokeTest/RmCoreSmokeTests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 b/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 index 37770d9fe82e..9a076303df01 100644 --- a/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 +++ b/tools/Test/SmokeTest/RmCoreSmokeTests.ps1 @@ -52,7 +52,7 @@ function Retry-AzCommand { $loopLimit = 0 do { try { - $script = if($loopLimit -gt 0) {"`$ErrorActionPreference='Continue' `n"} Else {"`$ErrorActionPreference='SilentlyContinue' `n"} + $script = "`$ErrorActionPreference='Continue' `n" $script += $Command.ToString() &([ScriptBlock]::Create($script)) break