Skip to content

Commit 3915435

Browse files
authored
Live test update (#21942)
* Fixed error message when exception occurs on creating resource group and added link for pipeline in email notification * Disabled live test for Resources due to errors * Merged tenant id for kusto and live test after moving kusto from one tenant to another and shortened parameter names.
1 parent 9db0a3e commit 3915435

File tree

8 files changed

+22
-17
lines changed

8 files changed

+22
-17
lines changed

.azure-pipelines/util/live-test-steps.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ jobs:
113113
pwsh: true
114114
targetType: filePath
115115
filePath: ./tools/TestFx/Live/InvokeLiveTestCITask.ps1
116-
arguments: -UseWindowsPowerShell ('${{ parameters.psVersion }}' -eq '5.1') -ScriptFile './tools/TestFx/Live/ConnectLiveTestServicePrincipal.ps1 $(LiveTestServicePrincipalSubscriptionId) $(LiveTestServicePrincipalTenantId) $(LiveTestServicePrincipalId) $(LiveTestServicePrincipalSecret)'
116+
arguments: -UseWindowsPowerShell ('${{ parameters.psVersion }}' -eq '5.1') -ScriptFile './tools/TestFx/Live/ConnectLiveTestServicePrincipal.ps1 $(LiveTestSubscriptionId) $(LiveTestTenantId) $(LiveTestServicePrincipalId) $(LiveTestServicePrincipalSecret)'
117117
failOnStderr: true
118118
retryCountOnTaskFailure: 3
119119

@@ -133,7 +133,7 @@ jobs:
133133
pwsh: true
134134
targetType: filePath
135135
filePath: ./tools/TestFx/Live/SaveLiveTestResult.ps1
136-
arguments: $(KustoServicePrincipalTenantId) $(KustoServicePrincipalId) $(KustoServicePrincipalSecret) $(KustoClusterName) $(KustoClusterRegion)
136+
arguments: $(LiveTestTenantId) $(KustoServicePrincipalId) $(KustoServicePrincipalSecret) $(KustoClusterName) $(KustoClusterRegion)
137137

138138
- task: PublishPipelineArtifact@1
139139
displayName: Publish live test results to pipeline artifact

tools/TestFx/Coverage/SaveTestCoverageResult.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ param (
55

66
[Parameter(Mandatory, Position = 1)]
77
[ValidateNotNullOrEmpty()]
8-
[guid] $KustoServicePrincipalTenantId,
8+
[guid] $TenantId,
99

1010
[Parameter(Mandatory, Position = 2)]
1111
[ValidateNotNullOrEmpty()]
12-
[guid] $KustoServicePrincipalId,
12+
[guid] $ServicePrincipalId,
1313

1414
[Parameter(Mandatory, Position = 3)]
1515
[ValidateNotNullOrEmpty()]
16-
[string] $KustoServicePrincipalSecret,
16+
[string] $ServicePrincipalSecret,
1717

1818
[Parameter(Mandatory, Position = 4)]
1919
[ValidateNotNullOrEmpty()]
@@ -30,7 +30,7 @@ $script:AzPSCommonParameters = @("-Break", "-Confirm", "-Debug", "-DefaultProfil
3030
$cvgDir = Join-Path -Path ${env:TESTCOVERAGELOCATION} -ChildPath "TestCoverageAnalysis" | Join-Path -ChildPath "Raw"
3131
if (Test-Path -LiteralPath $cvgDir -PathType Container) {
3232
$kustoUtil = Join-Path -Path ($PSScriptRoot | Split-Path) -ChildPath "Utilities" | Join-Path -ChildPath "KustoUtility.psd1"
33-
Import-Module $kustoUtil -ArgumentList $KustoServicePrincipalTenantId, $KustoServicePrincipalId, $KustoServicePrincipalSecret, $ClusterName, $ClusterRegion -Force
33+
Import-Module $kustoUtil -ArgumentList $TenantId, $ServicePrincipalId, $ServicePrincipalSecret, $ClusterName, $ClusterRegion -Force
3434

3535
$cvgRawCsv = Get-ChildItem -Path $cvgDir -Filter "*.csv" -File | Select-Object -ExpandProperty FullName
3636
$cvgRawCsv | ForEach-Object {

tools/TestFx/Live/DebugLocalLiveTestScenarios.ps1

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ param (
55

66
[Parameter()]
77
[ValidateNotNullOrEmpty()]
8-
[string] $RunPlatform = "Windows"
8+
[string] $RunPlatform = "Windows",
9+
10+
[Parameter()]
11+
[switch] $NoModuleImport
912
)
1013

1114
function ImportLocalAzModules {
@@ -29,7 +32,7 @@ function InvokeLocalLiveTestScenarios {
2932
param (
3033
[Parameter()]
3134
[ValidateNotNullOrEmpty()]
32-
[string[]] $TargetModules,
35+
[string[]] $TargetModule,
3336

3437
[Parameter()]
3538
[ValidateScript({ Test-Path -LiteralPath $_ -PathType Container })]
@@ -40,7 +43,7 @@ function InvokeLocalLiveTestScenarios {
4043
$liveScenarios = Get-ChildItem -Path $srcDir -Recurse -Directory -Filter "LiveTests" | Get-ChildItem -Filter "TestLiveScenarios.ps1" -File | Select-Object -ExpandProperty FullName
4144
$liveScenarios | ForEach-Object {
4245
$moduleName = [regex]::match($_, "[\\|\/]src[\\|\/](?<ModuleName>[a-zA-Z]+)[\\|\/]").Groups["ModuleName"].Value
43-
if (!$PSBoundParameters.ContainsKey("TargetModules") -or $moduleName -in $TargetModules) {
46+
if (!$PSBoundParameters.ContainsKey("TargetModule") -or $moduleName -in $TargetModule) {
4447
Write-Host "Executing live test scenarios for module $moduleName" -ForegroundColor Cyan
4548
Import-Module "./tools/TestFx/Assert.ps1" -Force
4649
Import-Module "./tools/TestFx/Live/LiveTestUtility.psd1" -ArgumentList $moduleName, $RunPlatform, $Output -Force
@@ -65,4 +68,6 @@ function InvokeLocalLiveTestScenarios {
6568
$cleanupJobs | Remove-Job
6669
}
6770

68-
ImportLocalAzModules
71+
if (!$NoModuleImport.IsPresent) {
72+
ImportLocalAzModules
73+
}

tools/TestFx/Live/LiveTestUtility.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ function Invoke-LiveTestScenario {
354354
}
355355
catch {
356356
$snrErrorMessage = $_.Exception.Message
357-
Write-Error "##[error]Error occurred when executing the live scenario `"$Name`" with error details `"$snrErrorDetails`"." -ErrorAction Continue
357+
Write-Error "##[error]Error occurred when executing the live scenario `"$Name`" with error details `"$snrErrorMessage`"." -ErrorAction Continue
358358
$snrCsvData.IsSuccess = $false
359359
$snrCsvData.Errors = ConvertToLiveTestJsonErrors -Errors $snrErrorMessage
360360
}

tools/TestFx/Live/SaveLiveTestResult.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
param (
22
[Parameter(Mandatory, Position = 0)]
33
[ValidateNotNullOrEmpty()]
4-
[guid] $ServicePrincipalTenantId,
4+
[guid] $TenantId,
55

66
[Parameter(Mandatory, Position = 1)]
77
[ValidateNotNullOrEmpty()]
@@ -24,7 +24,7 @@ $ltDir = Join-Path -Path ${env:DATALOCATION} -ChildPath "LiveTestAnalysis" | Joi
2424
$ltResults = Get-ChildItem -Path $ltDir -Filter "*.csv" -File -ErrorAction SilentlyContinue | Select-Object -ExpandProperty FullName
2525

2626
if (![string]::IsNullOrEmpty($ltResults)) {
27-
Import-Module "./tools/TestFx/Utilities/KustoUtility.psd1" -ArgumentList $ServicePrincipalTenantId, $ServicePrincipalId, $ServicePrincipalSecret, $ClusterName, $ClusterRegion -Force
27+
Import-Module "./tools/TestFx/Utilities/KustoUtility.psd1" -ArgumentList $TenantId, $ServicePrincipalId, $ServicePrincipalSecret, $ClusterName, $ClusterRegion -Force
2828
Add-KustoData -DatabaseName ${env:LIVETESTDATABASENAME} -TableName ${env:LIVETESTTABLENAME} -CsvFile $ltResults
2929
}
3030
else {

tools/TestFx/Live/SendLiveTestReport.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ $summarySection = @"
7171
</tr>
7272
<tr>
7373
<td><b>Build Number:</b></td>
74-
<td>${env:BUILD_BUILDID}</td>
74+
<td><a href="${env:LIVETESTPIPELINEURL}/_build/results?buildId=${env:BUILD_BUILDID}">${env:BUILD_BUILDID}</a></td>
7575
</tr>
7676
<tr>
7777
<td><b>Build Reason:</b></td>

tools/TestFx/Utilities/KustoUtility.psm1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
param (
1515
[Parameter(Mandatory)]
1616
[ValidateNotNullOrEmpty()]
17-
[guid] $ServicePrincipalTenantId,
17+
[guid] $TenantId,
1818

1919
[Parameter(Mandatory)]
2020
[ValidateNotNullOrEmpty()]
@@ -87,7 +87,7 @@ function Add-KustoData {
8787
)
8888

8989
$ingestUri = "https://ingest-$ClusterName.$ClusterRegion.kusto.windows.net"
90-
$ingestBuilder = [Kusto.Data.KustoConnectionStringBuilder]::new($ingestUri).WithAadApplicationKeyAuthentication($ServicePrincipalId, $ServicePrincipalSecret, $ServicePrincipalTenantId.ToString())
90+
$ingestBuilder = [Kusto.Data.KustoConnectionStringBuilder]::new($ingestUri).WithAadApplicationKeyAuthentication($ServicePrincipalId, $ServicePrincipalSecret, $TenantId.ToString())
9191
IngestDataFromCsv -IngestBuilder $ingestBuilder -DatabaseName $DatabaseName -TableName $TableName -CsvFile $CsvFile
9292
}
9393

@@ -151,7 +151,7 @@ function Get-KustoQueryData {
151151
)
152152

153153
$queryUri = "https://$ClusterName.$ClusterRegion.kusto.windows.net"
154-
$queryBuilder = [Kusto.Data.KustoConnectionStringBuilder]::new($queryUri).WithAadApplicationKeyAuthentication($ServicePrincipalId, $ServicePrincipalSecret, $ServicePrincipalTenantId.ToString())
154+
$queryBuilder = [Kusto.Data.KustoConnectionStringBuilder]::new($queryUri).WithAadApplicationKeyAuthentication($ServicePrincipalId, $ServicePrincipalSecret, $TenantId.ToString())
155155
$queryClient = [Kusto.Data.Net.Client.KustoClientFactory]::CreateCslQueryProvider($queryBuilder)
156156
$queryResult = $queryClient.ExecuteQuery($DatabaseName, $Query, $null)
157157
$results = @()

0 commit comments

Comments
 (0)