From c2e6607f0b056273371a150bf531ef5662a83b9f Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Tue, 20 Dec 2022 14:15:36 -0500 Subject: [PATCH] Sync eng/common directory with azure-sdk-tools for PR 4880 (#4203) --- .../pipelines/templates/jobs/docindex.yml | 2 +- eng/common/scripts/job-matrix/README.md | 12 +++--- .../scripts/job-matrix/samples/matrix.json | 6 +-- .../job-matrix-functions.filter.tests.ps1 | 22 +++++----- ...ob-matrix-functions.modification.tests.ps1 | 20 +++++----- .../tests/job-matrix-functions.tests.ps1 | 40 +++++++++---------- 6 files changed, 51 insertions(+), 51 deletions(-) diff --git a/eng/common/pipelines/templates/jobs/docindex.yml b/eng/common/pipelines/templates/jobs/docindex.yml index ea7b2997d..b695c8782 100644 --- a/eng/common/pipelines/templates/jobs/docindex.yml +++ b/eng/common/pipelines/templates/jobs/docindex.yml @@ -1,7 +1,7 @@ jobs: - job: CreateDocIndex pool: - vmImage: windows-2019 + vmImage: windows-2022 steps: - task: UsePythonVersion@0 displayName: 'Use Python 3.9' diff --git a/eng/common/scripts/job-matrix/README.md b/eng/common/scripts/job-matrix/README.md index d112c5357..a8dbf8961 100644 --- a/eng/common/scripts/job-matrix/README.md +++ b/eng/common/scripts/job-matrix/README.md @@ -100,7 +100,7 @@ Example: ``` "matrix": { "operatingSystem": [ - "windows-2019", + "windows-2022", "ubuntu-18.04", "macos-11" ], @@ -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" } } ``` @@ -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": "MMS2022", "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" } }, diff --git a/eng/common/scripts/job-matrix/samples/matrix.json b/eng/common/scripts/job-matrix/samples/matrix.json index 98e1dd757..4104051fb 100644 --- a/eng/common/scripts/job-matrix/samples/matrix.json +++ b/eng/common/scripts/job-matrix/samples/matrix.json @@ -5,7 +5,7 @@ "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" ] @@ -13,7 +13,7 @@ "include": [ { "Agent": { - "windows": { "OSVmImage": "windows-2019", "Pool": "Azure Pipelines" } + "windows": { "OSVmImage": "windows-2022", "Pool": "Azure Pipelines" } }, "TestTargetFramework": [ "net461", "net5.0" ], "AdditionalTestArguments": "/p:UseProjectReferenceToAzureClients=true" @@ -21,7 +21,7 @@ ], "exclude": [ { - "OSVmImage": "MMS2019", + "OSVmImage": "MMS2022", "framework": "netcoreapp2.1" } ] diff --git a/eng/common/scripts/job-matrix/tests/job-matrix-functions.filter.tests.ps1 b/eng/common/scripts/job-matrix/tests/job-matrix-functions.filter.tests.ps1 index 7c327eb27..7dce9e5ba 100644 --- a/eng/common/scripts/job-matrix/tests/job-matrix-functions.filter.tests.ps1 +++ b/eng/common/scripts/job-matrix/tests/job-matrix-functions.filter.tests.ps1 @@ -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" ] } @@ -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 @@ -33,11 +33,11 @@ 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 @@ -45,8 +45,8 @@ Describe "Matrix Filter" -Tag "filter" { } 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 @@ -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" { diff --git a/eng/common/scripts/job-matrix/tests/job-matrix-functions.modification.tests.ps1 b/eng/common/scripts/job-matrix/tests/job-matrix-functions.modification.tests.ps1 index 9dca8eba0..2ab9e654f 100644 --- a/eng/common/scripts/job-matrix/tests/job-matrix-functions.modification.tests.ps1 +++ b/eng/common/scripts/job-matrix/tests/job-matrix-functions.modification.tests.ps1 @@ -88,7 +88,7 @@ Describe "Platform Matrix nonSparse" -Tag "nonsparse" { $matrixJson = @' { "matrix": { - "$IMPORT": "./test-import-matrix.json", + "$IMPORT": "./eng/common/scripts/job-matrix/tests/test-import-matrix.json", "TestField1": "test1" }, "exclude": [ { "Baz": "importedBaz" } ] @@ -130,7 +130,7 @@ Describe "Platform Matrix Import" -Tag "import" { $matrixJson = @' { "matrix": { - "$IMPORT": "./test-import-matrix.json" + "$IMPORT": "./eng/common/scripts/job-matrix/tests/test-import-matrix.json" }, "include": [ { @@ -173,7 +173,7 @@ Describe "Platform Matrix Import" -Tag "import" { $matrixJson = @' { "matrix": { - "$IMPORT": "./test-import-matrix.json", + "$IMPORT": "./eng/common/scripts/job-matrix/tests/test-import-matrix.json", "TestField1": "test1", "TestField2": "test2" }, @@ -206,7 +206,7 @@ Describe "Platform Matrix Import" -Tag "import" { $matrixJson = @' { "matrix": { - "$IMPORT": "./test-import-matrix.json", + "$IMPORT": "./eng/common/scripts/job-matrix/tests/test-import-matrix.json", "testField": [ "test1", "test2" ] } } @@ -235,7 +235,7 @@ Describe "Platform Matrix Import" -Tag "import" { "importedBaz": "importedBazNameOverride" }, "matrix": { - "$IMPORT": "./test-import-matrix.json", + "$IMPORT": "./eng/common/scripts/job-matrix/tests/test-import-matrix.json", "testField": [ "test1", "test2" ] } } @@ -251,7 +251,7 @@ Describe "Platform Matrix Import" -Tag "import" { $matrixJson = @' { "matrix": { - "$IMPORT": "./test-import-matrix.json", + "$IMPORT": "./eng/common/scripts/job-matrix/tests/test-import-matrix.json", "testField1": [ "test11", "test12" ], "testField2": [ "test21", "test22" ] } @@ -299,7 +299,7 @@ Describe "Platform Matrix Import" -Tag "import" { $matrixJson = @' { "matrix": { - "$IMPORT": "./test-import-matrix.json", + "$IMPORT": "./eng/common/scripts/job-matrix/tests/test-import-matrix.json", "testField": [ "test1", "test2", "test3" ], }, "include": [ @@ -364,7 +364,7 @@ Describe "Platform Matrix Import" -Tag "import" { $matrixJson = @' { "matrix": { - "$IMPORT": "./test-import-matrix.json", + "$IMPORT": "./eng/common/scripts/job-matrix/tests/test-import-matrix.json", "Foo": [ "fooOverride1", "fooOverride2" ], } } @@ -450,7 +450,7 @@ Describe "Platform Matrix Replace" -Tag "replace" { $matrixJson = @' { "matrix": { - "$IMPORT": "./test-import-matrix.json", + "$IMPORT": "./eng/common/scripts/job-matrix/tests/test-import-matrix.json", "testField": [ "test1", "test2" ] } } @@ -550,7 +550,7 @@ Describe "Platform Matrix Replace" -Tag "replace" { "replaceme": "" }, "matrix": { - "$IMPORT": "./test-import-matrix.json", + "$IMPORT": "./eng/common/scripts/job-matrix/tests/test-import-matrix.json", "replaceme": "replaceme" } } diff --git a/eng/common/scripts/job-matrix/tests/job-matrix-functions.tests.ps1 b/eng/common/scripts/job-matrix/tests/job-matrix-functions.tests.ps1 index 689ed9108..bed3a51e5 100644 --- a/eng/common/scripts/job-matrix/tests/job-matrix-functions.tests.ps1 +++ b/eng/common/scripts/job-matrix/tests/job-matrix-functions.tests.ps1 @@ -10,7 +10,7 @@ BeforeAll { }, "matrix": { "operatingSystem": [ - "windows-2019", + "windows-2022", "ubuntu-18.04", "macos-11" ], @@ -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" }, { @@ -273,7 +273,7 @@ Describe "Platform Matrix Generation" -Tag "generate" { }, "matrix": { "operatingSystem": [ - "windows-2019", + "windows-2022", "ubuntu-18.04", "macos-11" ], @@ -288,7 +288,7 @@ Describe "Platform Matrix Generation" -Tag "generate" { }, "include": [ { - "operatingSystem": "windows-2019", + "operatingSystem": "windows-2022", "framework": "net461", "additionalTestArguments": "/p:UseProjectReferenceToAzureClients=true" } @@ -315,13 +315,13 @@ 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" $element = GetNdMatrixElement @(2, 1, 1) $matrix $dimensions - $element.name | Should -Be "macOS1015_netcoreapp21_withFoo" + $element.name | Should -Be "macOS11_netcoreapp21_withFoo" } It "Should initialize an N-dimensional matrix from all parameter permutations" { @@ -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 "" @@ -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 = ""; } ) { @@ -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" @@ -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" @@ -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" } @@ -456,7 +456,7 @@ Describe "Platform Matrix Post Transformation" -Tag "transform" { { "include": [ { - "operatingSystem": "windows-2019", + "operatingSystem": "windows-2022", "framework": "net461" } ] @@ -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" } } @@ -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" } }