Azure / Azure/azure-powershell

[Feature]: Improve the performance of scenario test

Open
#16,655 0 comments 0 reactions 1 assignee Claimed by @vidai-msft View on GitHub
feature-request Test Infra
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description of the new feature

Scenario test load below all required modules and enable its AzureRM alias. For instance, below script is test of network module. `Enable-AzureRmAlias` takes relative long time. It impacts the efficiency of whole module test execution.

We need to either update test cases and remove `Enable-AzureRmAlias` or just execute `Enable-AzureRmAlias` once.

```
Set-ExecutionPolicy Unrestricted -Scope Process -ErrorAction Ignore
$error.clear()
Write-Debug "current directory: C:\Dev\Azure\azure-powershell\src\Network\Network.Test\bin\Debug\netcoreapp2.1\"
Write-Debug "current executing assembly: C:\Dev\Azure\azure-powershell\src\Network\Network.Test\bin\Debug\netcoreapp2.1"
cd "C:\Dev\Azure\azure-powershell\src\Network\Network.Test\bin\Debug\netcoreapp2.1\"
Import-Module "C:\Dev\Azure\azure-powershell\src\Network\Network.Test\bin\Debug\netcoreapp2.1\Assert.ps1"
Import-Module "C:\Dev\Azure\azure-powershell\src\Network\Network.Test\bin\Debug\netcoreapp2.1\Common.ps1"
Import-Module "C:\Dev\Azure\azure-powershell\artifacts\Debug\Az.Accounts\Az.Accounts.psd1"
Enable-AzureRmAlias -Module Az.Accounts
Import-Module "C:\Dev\Azure\azure-powershell\artifacts\Debug\Az.Monitor\Az.Monitor.psd1"
Enable-AzureRmAlias -Module Az.Monitor
Import-Module "C:\Dev\Azure\azure-powershell\artifacts\Debug\Az.Network\Az.Network.psd1"
Enable-AzureRmAlias -Module Az.Network
Import-Module "C:\Dev\Azure\azure-powershell\artifacts\Debug\Az.Compute\Az.Compute.psd1"
Enable-AzureRmAlias -Module Az.Compute
Import-Module "C:\Dev\Azure\azure-powershell\artifacts\Debug\Az.Storage\Az.Storage.psd1"
Enable-AzureRmAlias -Module Az.Storage
Import-Module "C:\Dev\Azure\azure-powershell\artifacts\Debug\Az.Sql\Az.Sql.psd1"
Enable-AzureRmAlias -Module Az.Sql
Import-Module "C:\Dev\Azure\azure-powershell\artifacts\Debug\Az.OperationalInsights\Az.OperationalInsights.psd1"
Enable-AzureRmAlias -Module Az.OperationalInsights
Import-Module "C:\Dev\Azure\azure-powershell\artifacts\Debug\Az.KeyVault\Az.KeyVault.psd1"
Enable-AzureRmAlias -Module Az.KeyVault
Import-Module "C:\Dev\Azure\azure-powershell\artifacts\Debug\Az.ManagedServiceIdentity\Az.ManagedServiceIdentity.psd1"
Enable-AzureRmAlias -Module Az.ManagedServiceIdentity
Import-Module "C:\Dev\Azure\azure-powershell\artifacts\Debug\Az.PrivateDns\Az.PrivateDns.psd1"
Enable-AzureRmAlias -Module Az.PrivateDns
Import-Module "C:\Dev\Azure\azure-powershell\src\Network\Network.Test\bin\Debug\netcoreapp2.1\ScenarioTests\Common.ps1"
Import-Module "C:\Dev\Azure\azure-powershell\src\Network\Network.Test\bin\Debug\netcoreapp2.1\AzureRM.Resources.ps1"
Import-Module "C:\Dev\Azure\azure-powershell\src\Network\Network.Test\bin\Debug\netcoreapp2.1\ScenarioTests\NetworkWatcherAPITests.ps1"
Disable-AzureRmDataCollection -ErrorAction Ignore
set-location "C:\Dev\Azure\azure-powershell\src\Network\Network.Test\bin\Debug\netcoreapp2.1\"
$TestOutputRoot='C:\Dev\Azure\azure-powershell\src\Network\Network.Test\bin\Debug\netcoreapp2.1\'
$VerbosePreference='Continue'
$DebugPreference='Continue'
$ErrorActionPreference='Stop'
Write-Debug "AZURE_TEST_MODE = $($env:AZURE_TEST_MODE)"
Write-Debug "TEST_HTTPMOCK_OUTPUT = $($env:TEST_HTTPMOCK_OUTPUT)"

```

### Proposed implementation details (optional)

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.