Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools repository for Tools P…
Browse files Browse the repository at this point in the history
…R 4879
  • Loading branch information
azure-sdk committed Dec 5, 2022
1 parent 664833d commit 1d28695
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion eng/common/pipelines/templates/jobs/docindex.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
jobs:
- job: CreateDocIndex
pool:
vmImage: windows-2019
vmImage: windows-2022
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.9'
Expand Down
14 changes: 7 additions & 7 deletions eng/common/scripts/job-matrix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Example:
```
"matrix": {
"operatingSystem": [
"windows-2019",
"windows-2022",
"ubuntu-18.04",
"macos-11"
],
Expand Down Expand Up @@ -386,14 +386,14 @@ In the matrix job output that azure pipelines consumes, the format is a dictiona
"framework": "net50",
"operatingSystem": "ubuntu-18.04"
},
"netcoreapp21_windows2019": {
"netcoreapp21_windows2022": {
"framework": "netcoreapp2.1",
"operatingSystem": "windows-2019"
"operatingSystem": "windows-2022"
},
"UseProjectRef_net461_windows2019": {
"UseProjectRef_net461_windows2022": {
"additionalTestArguments": "/p:UseProjectReferenceToAzureClients=true",
"framework": "net461",
"operatingSystem": "windows-2019"
"operatingSystem": "windows-2022"
}
}
```
Expand Down Expand Up @@ -510,7 +510,7 @@ Given a matrix like below with `JavaTestVersion` marked as a non-sparse paramete
{
"matrix": {
"Agent": {
"windows-2019": { "OSVmImage": "MMS2019", "Pool": "azsdk-pool-mms-win-2019-general" },
"windows-2022": { "OSVmImage": "MMS2019", "Pool": "azsdk-pool-mms-win-2022-general" },
"ubuntu-1804": { "OSVmImage": "MMSUbuntu18.04", "Pool": "azsdk-pool-mms-ubuntu-1804-general" },
"macos-11": { "OSVmImage": "macos-11", "Pool": "Azure Pipelines" }
},
Expand Down Expand Up @@ -558,4 +558,4 @@ Discovery finished in 75ms.
[+] /home/ben/sdk/azure-sdk-tools/eng/common/scripts/job-matrix/tests/job-matrix-functions.tests.ps1 2.71s (725ms|1.93s)
Tests completed in 4.33s
Tests Passed: 141, Failed: 0, Skipped: 4 NotRun: 0
```
```
6 changes: 3 additions & 3 deletions eng/common/scripts/job-matrix/samples/matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
"matrix": {
"Agent": {
"ubuntu": { "OSVmImage": "ubuntu-18.04", "Pool": "Azure Pipelines" },
"windows": { "OSVmImage": "windows-2019", "Pool": "Azure Pipelines" },
"windows": { "OSVmImage": "windows-2022", "Pool": "Azure Pipelines" },
"macOS": { "OSVmImage": "macos-11", "Pool": "Azure Pipelines" }
},
"TestTargetFramework": [ "netcoreapp2.1", "net461", "net5.0" ]
},
"include": [
{
"Agent": {
"windows": { "OSVmImage": "windows-2019", "Pool": "Azure Pipelines" }
"windows": { "OSVmImage": "windows-2022", "Pool": "Azure Pipelines" }
},
"TestTargetFramework": [ "net461", "net5.0" ],
"AdditionalTestArguments": "/p:UseProjectReferenceToAzureClients=true"
Expand All @@ -25,4 +25,4 @@
"framework": "netcoreapp2.1"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ BeforeAll {
$matrixConfig = @"
{
"matrix": {
"operatingSystem": [ "windows-2019", "ubuntu-18.04", "macos-11" ],
"operatingSystem": [ "windows-2022", "ubuntu-18.04", "macos-11" ],
"framework": [ "net461", "netcoreapp2.1" ],
"additionalArguments": [ "", "mode=test" ]
}
Expand All @@ -17,8 +17,8 @@ BeforeAll {

Describe "Matrix Filter" -Tag "filter" {
It "Should filter by matrix display name" -TestCases @(
@{ regex = "windows.*"; expectedFirst = "windows2019_net461"; length = 4 }
@{ regex = "windows2019_netcoreapp21_modetest"; expectedFirst = "windows2019_netcoreapp21_modetest"; length = 1 }
@{ regex = "windows.*"; expectedFirst = "windows2022_net461"; length = 4 }
@{ regex = "windows2022_netcoreapp21_modetest"; expectedFirst = "windows2022_netcoreapp21_modetest"; length = 1 }
@{ regex = ".*ubuntu.*"; expectedFirst = "ubuntu1804_net461"; length = 4 }
) {
[array]$matrix = GenerateMatrix $config "all" $regex
Expand All @@ -33,20 +33,20 @@ Describe "Matrix Filter" -Tag "filter" {
}

It "Should filter by matrix key/value" -TestCases @(
@{ filterString = "operatingSystem=windows.*"; expectedFirst = "windows2019_net461"; length = 4 }
@{ filterString = "operatingSystem=windows-2019"; expectedFirst = "windows2019_net461"; length = 4 }
@{ filterString = "framework=.*"; expectedFirst = "windows2019_net461"; length = 12 }
@{ filterString = "additionalArguments=mode=test"; expectedFirst = "windows2019_net461_modetest"; length = 6 }
@{ filterString = "additionalArguments=^$"; expectedFirst = "windows2019_net461"; length = 6 }
@{ filterString = "operatingSystem=windows.*"; expectedFirst = "windows2022_net461"; length = 4 }
@{ filterString = "operatingSystem=windows-2022"; expectedFirst = "windows2022_net461"; length = 4 }
@{ filterString = "framework=.*"; expectedFirst = "windows2022_net461"; length = 12 }
@{ filterString = "additionalArguments=mode=test"; expectedFirst = "windows2022_net461_modetest"; length = 6 }
@{ filterString = "additionalArguments=^$"; expectedFirst = "windows2022_net461"; length = 6 }
) {
[array]$matrix = GenerateMatrix $config "all" -filters @($filterString)
$matrix.Length | Should -Be $length
$matrix[0].Name | Should -Be $expectedFirst
}

It "Should filter by optional matrix key/value" -TestCases @(
@{ filterString = "operatingSystem=^$|windows.*"; expectedFirst = "windows2019_net461"; length = 4 }
@{ filterString = "doesnotexist=^$|.*"; expectedFirst = "windows2019_net461"; length = 12 }
@{ filterString = "operatingSystem=^$|windows.*"; expectedFirst = "windows2022_net461"; length = 4 }
@{ filterString = "doesnotexist=^$|.*"; expectedFirst = "windows2022_net461"; length = 12 }
) {
[array]$matrix = GenerateMatrix $config "all" -filters @($filterString)
$matrix.Length | Should -Be $length
Expand All @@ -56,7 +56,7 @@ Describe "Matrix Filter" -Tag "filter" {
It "Should handle multiple matrix key/value filters " {
[array]$matrix = GenerateMatrix $config "all" -filters "operatingSystem=windows.*","framework=.*","additionalArguments=mode=test"
$matrix.Length | Should -Be 2
$matrix[0].Name | Should -Be "windows2019_net461_modetest"
$matrix[0].Name | Should -Be "windows2022_net461_modetest"
}

It "Should handle no matrix key/value filter matches" {
Expand All @@ -81,4 +81,4 @@ Describe "Matrix Filter" -Tag "filter" {
[array]$matrix = FilterMatrix $matrix @("foo=^$")
$matrix.Length | Should -Be 12
}
}
}
40 changes: 20 additions & 20 deletions eng/common/scripts/job-matrix/tests/job-matrix-functions.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ BeforeAll {
},
"matrix": {
"operatingSystem": [
"windows-2019",
"windows-2022",
"ubuntu-18.04",
"macos-11"
],
Expand All @@ -25,14 +25,14 @@ BeforeAll {
},
"include": [
{
"operatingSystem": "windows-2019",
"operatingSystem": "windows-2022",
"framework": ["net461", "netcoreapp2.1", "net50"],
"additionalArguments": "--enableWindowsFoo"
}
],
"exclude": [
{
"operatingSystem": "windows-2019",
"operatingSystem": "windows-2022",
"framework": "net461"
},
{
Expand Down Expand Up @@ -273,7 +273,7 @@ Describe "Platform Matrix Generation" -Tag "generate" {
},
"matrix": {
"operatingSystem": [
"windows-2019",
"windows-2022",
"ubuntu-18.04",
"macos-11"
],
Expand All @@ -288,7 +288,7 @@ Describe "Platform Matrix Generation" -Tag "generate" {
},
"include": [
{
"operatingSystem": "windows-2019",
"operatingSystem": "windows-2022",
"framework": "net461",
"additionalTestArguments": "/p:UseProjectReferenceToAzureClients=true"
}
Expand All @@ -315,7 +315,7 @@ Describe "Platform Matrix Generation" -Tag "generate" {
$matrix = GenerateFullMatrix $generateConfig.matrixParameters $generateconfig.displayNamesLookup

$element = GetNdMatrixElement @(0, 0, 0) $matrix $dimensions
$element.name | Should -Be "windows2019_net461"
$element.name | Should -Be "windows2022_net461"

$element = GetNdMatrixElement @(1, 1, 1) $matrix $dimensions
$element.name | Should -Be "ubuntu1804_netcoreapp21_withFoo"
Expand All @@ -330,7 +330,7 @@ Describe "Platform Matrix Generation" -Tag "generate" {
$matrix.Count | Should -Be 12

$element = $matrix[0].parameters
$element.operatingSystem | Should -Be "windows-2019"
$element.operatingSystem | Should -Be "windows-2022"
$element.framework | Should -Be "net461"
$element.additionalArguments | Should -Be ""

Expand All @@ -346,7 +346,7 @@ Describe "Platform Matrix Generation" -Tag "generate" {
}

It "Should initialize a sparse matrix from an N-dimensional matrix" -TestCases @(
@{ i = 0; name = "windows2019_net461"; operatingSystem = "windows-2019"; framework = "net461"; additionalArguments = ""; }
@{ i = 0; name = "windows2022_net461"; operatingSystem = "windows-2022"; framework = "net461"; additionalArguments = ""; }
@{ i = 1; name = "ubuntu1804_netcoreapp21_withfoo"; operatingSystem = "ubuntu-18.04"; framework = "netcoreapp2.1"; additionalArguments = "--enableFoo"; }
@{ i = 2; name = "macOS11_net461"; operatingSystem = "macos-11"; framework = "net461"; additionalArguments = ""; }
) {
Expand Down Expand Up @@ -380,7 +380,7 @@ Describe "Config File Object Conversion" -Tag "convert" {

It "Should convert a matrix config" {
$config.matrixParameters[0].Name | Should -Be "operatingSystem"
$config.matrixParameters[0].Flatten()[0].Value | Should -Be "windows-2019"
$config.matrixParameters[0].Flatten()[0].Value | Should -Be "windows-2022"

$config.displayNamesLookup | Should -BeOfType [Hashtable]
$config.displayNamesLookup["--enableFoo"] | Should -Be "withFoo"
Expand Down Expand Up @@ -425,13 +425,13 @@ Describe "Platform Matrix Post Transformation" -Tag "transform" {
[Array]$matrix = GenerateMatrix $config "all"
$matrix.Length | Should -Be 8

$matrix[0].name | Should -Be "windows2019_netcoreapp21"
$matrix[0].parameters.operatingSystem | Should -Be "windows-2019"
$matrix[0].name | Should -Be "windows2022_netcoreapp21"
$matrix[0].parameters.operatingSystem | Should -Be "windows-2022"
$matrix[0].parameters.framework | Should -Be "netcoreapp2.1"
$matrix[0].parameters.additionalArguments | Should -Be ""

$matrix[1].name | Should -Be "windows2019_netcoreapp21_withfoo"
$matrix[1].parameters.operatingSystem | Should -Be "windows-2019"
$matrix[1].name | Should -Be "windows2022_netcoreapp21_withfoo"
$matrix[1].parameters.operatingSystem | Should -Be "windows-2022"
$matrix[1].parameters.framework | Should -Be "netcoreapp2.1"
$matrix[1].parameters.additionalArguments | Should -Be "--enableFoo"

Expand All @@ -445,9 +445,9 @@ Describe "Platform Matrix Post Transformation" -Tag "transform" {
$matrix[4].parameters.operatingSystem | Should -Be "macos-11"
$matrix[4].parameters.additionalArguments | Should -Be ""

$matrix[7].name | Should -Be "windows2019_net50_enableWindowsFoo"
$matrix[7].name | Should -Be "windows2022_net50_enableWindowsFoo"
$matrix[7].parameters.framework | Should -Be "net50"
$matrix[7].parameters.operatingSystem | Should -Be "windows-2019"
$matrix[7].parameters.operatingSystem | Should -Be "windows-2022"
$matrix[7].parameters.additionalArguments | Should -Be "--enableWindowsFoo"
}

Expand All @@ -456,7 +456,7 @@ Describe "Platform Matrix Post Transformation" -Tag "transform" {
{
"include": [
{
"operatingSystem": "windows-2019",
"operatingSystem": "windows-2022",
"framework": "net461"
}
]
Expand All @@ -466,14 +466,14 @@ Describe "Platform Matrix Post Transformation" -Tag "transform" {
$config = GetMatrixConfigFromJson $matrixConfigForIncludeOnly
[Array]$matrix = GenerateMatrix $config "all"
$matrix.Length | Should -Be 1
$matrix[0].name | Should -Be "windows2019_net461"
$matrix[0].name | Should -Be "windows2022_net461"
}

It "Should parse a config with an empty include" {
$matrixConfigForIncludeOnly = @"
{
"matrix": {
"operatingSystem": "windows-2019",
"operatingSystem": "windows-2022",
"framework": "net461"
}
}
Expand All @@ -482,7 +482,7 @@ Describe "Platform Matrix Post Transformation" -Tag "transform" {
$config = GetMatrixConfigFromJson $matrixConfigForIncludeOnly
[Array]$matrix = GenerateMatrix $config "all"
$matrix.Length | Should -Be 1
$matrix[0].name | Should -Be "windows2019_net461"
$matrix[0].name | Should -Be "windows2022_net461"
}
}

Expand Down Expand Up @@ -651,4 +651,4 @@ Describe "Platform Matrix Job and Display Names" -Tag "displaynames" {
$matrix = GenerateMatrix $generateConfig "sparse"
$matrix[0].name | Should -Be "ubuntu1804_net461_TestObjectValueName"
}
}
}

0 comments on commit 1d28695

Please sign in to comment.