Skip to content

Commit 8738560

Browse files
authored
Fixed Kusto utility parameter issue (#21658)
* Updated agent pool from windows to linux * Fixed Kusto util arguments issue and removed the unnecessary parameters from the list
1 parent 494c79a commit 8738560

File tree

2 files changed

+12
-36
lines changed

2 files changed

+12
-36
lines changed

.azure-pipelines/test-coverage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ parameters:
22
- name: poolName
33
displayName: Pool Name
44
type: string
5-
default: pool-ubuntu-2004
5+
default: pool-windows-2019
66
- name: dotnet_sdk_3_1
77
displayName: .NET Core 3.1
88
default: 3.1.x
@@ -102,7 +102,7 @@ jobs:
102102
pwsh: true
103103
targetType: filePath
104104
filePath: ./tools/TestFx/Coverage/SaveTestCoverageResult.ps1
105-
arguments: CITest $(Build.BuildId) $(KustoServicePrincipalTenantId) $(KustoServicePrincipalId) $(KustoServicePrincipalSecret) $(KustoClusterName) $(KustoClusterRegion) $(TestCoverageDatabaseName) $(TestCoverageTableName) $(TestCoverageLocation)
105+
arguments: CITest $(KustoServicePrincipalTenantId) $(KustoServicePrincipalId) $(KustoServicePrincipalSecret) $(KustoClusterName) $(KustoClusterRegion)
106106

107107
- task: PowerShell@2
108108
displayName: Update Test Coverage Baseline

tools/TestFx/Coverage/SaveTestCoverageResult.ps1

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

66
[Parameter(Mandatory, Position = 1)]
77
[ValidateNotNullOrEmpty()]
8-
[string] $BuildId,
9-
10-
[Parameter(Mandatory, Position = 2)]
11-
[ValidateNotNullOrEmpty()]
128
[guid] $KustoServicePrincipalTenantId,
139

14-
[Parameter(Mandatory, Position = 3)]
10+
[Parameter(Mandatory, Position = 2)]
1511
[ValidateNotNullOrEmpty()]
1612
[guid] $KustoServicePrincipalId,
1713

18-
[Parameter(Mandatory, Position = 4)]
14+
[Parameter(Mandatory, Position = 3)]
1915
[ValidateNotNullOrEmpty()]
2016
[string] $KustoServicePrincipalSecret,
2117

22-
[Parameter(Mandatory, Position = 5)]
18+
[Parameter(Mandatory, Position = 4)]
2319
[ValidateNotNullOrEmpty()]
2420
[string] $ClusterName,
2521

26-
[Parameter(Mandatory, Position = 6)]
27-
[ValidateNotNullOrEmpty()]
28-
[string] $ClusterRegion,
29-
30-
[Parameter(Mandatory, Position = 7)]
31-
[ValidateNotNullOrEmpty()]
32-
[string] $DatabaseName,
33-
34-
[Parameter(Mandatory, Position = 8)]
22+
[Parameter(Mandatory, Position = 5)]
3523
[ValidateNotNullOrEmpty()]
36-
[string] $TableName,
37-
38-
[Parameter(Mandatory, Position = 9)]
39-
[ValidateNotNull()]
40-
[ValidateScript({ Test-Path -LiteralPath $_ -PathType Container })]
41-
[string] $DataLocation
24+
[string] $ClusterRegion
4225
)
4326

4427
$script:AzPSCommonParameters = @("-Break", "-Confirm", "-Debug", "-DefaultProfile", "-ErrorAction", "-ErrorVariable", "-HttpPipelineAppend", "-HttpPipelinePrepend", "-InformationAction", "-InformationVariable",
4528
"-OutBuffer", "-OutVariable", "-PassThru", "-PipelineVariable", "-Proxy", "-ProxyCredential", "-ProxyUseDefaultCredentials", "-Verbose", "-WarningAction", "-WarningVariable", "-WhatIf")
4629

47-
$cvgDir = Join-Path -Path $DataLocation -ChildPath "TestCoverageAnalysis" | Join-Path -ChildPath "Raw"
30+
$cvgDir = Join-Path -Path ${env:TESTCOVERAGELOCATION} -ChildPath "TestCoverageAnalysis" | Join-Path -ChildPath "Raw"
4831
if (Test-Path -LiteralPath $cvgDir -PathType Container) {
49-
Import-Module (Join-Path -Path ($PSScriptRoot | Split-Path) -ChildPath "Utilities" | Join-Path -ChildPath "KustoUtility.psd1") -Force
32+
$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
5034

5135
$cvgRawCsv = Get-ChildItem -Path $cvgDir -Filter "*.csv" -File | Select-Object -ExpandProperty FullName
5236
$cvgRawCsv | ForEach-Object {
5337
(Import-Csv -Path $_) |
5438
Select-Object `
5539
@{ Name = "Source"; Expression = { $Source } }, `
56-
@{ Name = "BuildId"; Expression = { $BuildId } }, `
40+
@{ Name = "BuildId"; Expression = { ${env:BUILD_BUILDID} } }, `
5741
@{ Name = "Module"; Expression = { $_.Module } }, `
5842
@{ Name = "CommandName"; Expression = { $_.CommandName } }, `
5943
@{ Name = "TotalCommands"; Expression = { $_.TotalCommands } }, `
@@ -69,15 +53,7 @@ if (Test-Path -LiteralPath $cvgDir -PathType Container) {
6953
Export-Csv -Path $_ -Encoding utf8 -NoTypeInformation -Force
7054
}
7155

72-
Import-KustoDataFromCsv `
73-
-ServicePrincipalTenantId $KustoServicePrincipalTenantId `
74-
-ServicePrincipalId $KustoServicePrincipalId `
75-
-ServicePrincipalSecret $KustoServicePrincipalSecret `
76-
-ClusterName $ClusterName `
77-
-ClusterRegion $ClusterRegion `
78-
-DatabaseName $DatabaseName `
79-
-TableName $TableName `
80-
-CsvFile $cvgRawCsv
56+
Import-KustoDataFromCsv -DatabaseName ${env:TESTCOVERAGEDATABASENAME} -TableName ${env:TESTCOVERAGETABLENAME} -CsvFile $cvgRawCsv
8157
}
8258
else {
8359
Write-Host "##[warning]No test coverage data was found." -ForegroundColor Yellow

0 commit comments

Comments
 (0)