From a3385b92e320459f4f8f4a52f16513c1ca18547b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 1 Jun 2022 10:31:28 -0700 Subject: [PATCH] Update to use `windows-latest` as the build agent image (#17418) * Update to use 'windows-latest' as the build agent image * Update additional files * debug test failures * Added some more wincompat debug info * Added some more wincompat debug info 2 * Stabilizing some wincompat tests when they are run on OS with compatibility-bugged WindowsPS buitin modules * Stabilizing some wincompat tests * Add verbose message to 'Enable-WSManCredSSP' test * More debugging * Make the 'Enable-WSManCredSSP' test more stable * Address feedback * remove broken tests * Fix Spelling * remove more broken TLS tests * remove broken tests Co-authored-by: Dongbo Wang Co-authored-by: unknown Co-authored-by: Travis Plunk --- .spelling | 5 +++++ .vsts-ci/templates/ci-build.yml | 2 +- .vsts-ci/templates/credscan.yml | 4 ++-- .vsts-ci/templates/nanoserver.yml | 2 +- .vsts-ci/templates/verify-xunit.yml | 2 +- .vsts-ci/templates/windows-test.yml | 4 ++-- .vsts-ci/windows-daily.yml | 2 +- .../windows/templates/windows-packaging.yml | 4 ++-- .../CompatiblePSEditions.Module.Tests.ps1 | 9 ++++++++ .../WebCmdlets.Tests.ps1 | 20 ------------------ .../CredSSP.Tests.ps1 | 21 +++++++++++++------ 11 files changed, 39 insertions(+), 36 deletions(-) diff --git a/.spelling b/.spelling index 16b157dee12a..656385cbe97a 100644 --- a/.spelling +++ b/.spelling @@ -1133,6 +1133,10 @@ Microsoft.Management.UI.Internal StringComparison osx-arm64 crossgen2 +mcr.microsoft.com +global.json +sha256 +PkgES - CHANGELOG.md aavdberg asrosent @@ -1410,6 +1414,7 @@ ThirdPartyNotices.txt rtm.21527.11 SKUs vmImage +Ubuntu22.04 - CHANGELOG/7.0.md codesign release-BuildJson diff --git a/.vsts-ci/templates/ci-build.yml b/.vsts-ci/templates/ci-build.yml index cbbd5349417b..e64ab4967a21 100644 --- a/.vsts-ci/templates/ci-build.yml +++ b/.vsts-ci/templates/ci-build.yml @@ -1,5 +1,5 @@ parameters: - pool: 'vs2017-win2016' + pool: 'windows-latest' jobName: 'win_build' displayName: Windows Build diff --git a/.vsts-ci/templates/credscan.yml b/.vsts-ci/templates/credscan.yml index f6ed5b8fd236..60094ff3d777 100644 --- a/.vsts-ci/templates/credscan.yml +++ b/.vsts-ci/templates/credscan.yml @@ -1,12 +1,12 @@ parameters: - pool: 'Hosted VS2017' + pool: 'windows-latest' jobName: 'credscan' displayName: Secret Scan jobs: - job: ${{ parameters.jobName }} pool: - name: ${{ parameters.pool }} + vmImage: ${{ parameters.pool }} displayName: ${{ parameters.displayName }} diff --git a/.vsts-ci/templates/nanoserver.yml b/.vsts-ci/templates/nanoserver.yml index c989d01c2f8a..ae9f639b3b2d 100644 --- a/.vsts-ci/templates/nanoserver.yml +++ b/.vsts-ci/templates/nanoserver.yml @@ -1,5 +1,5 @@ parameters: - vmImage: 'windows-2019' + vmImage: 'windows-latest' jobName: 'Nanoserver_Tests' continueOnError: false diff --git a/.vsts-ci/templates/verify-xunit.yml b/.vsts-ci/templates/verify-xunit.yml index 9e09584d5c34..d2799f53ae0e 100644 --- a/.vsts-ci/templates/verify-xunit.yml +++ b/.vsts-ci/templates/verify-xunit.yml @@ -1,6 +1,6 @@ parameters: parentJobs: [] - pool: 'vs2017-win2016' + pool: 'windows-latest' jobName: 'xunit_verify' jobs: diff --git a/.vsts-ci/templates/windows-test.yml b/.vsts-ci/templates/windows-test.yml index b316f8f360e8..475c40c665c0 100644 --- a/.vsts-ci/templates/windows-test.yml +++ b/.vsts-ci/templates/windows-test.yml @@ -1,5 +1,5 @@ parameters: - pool: 'Hosted VS2017' + pool: 'windows-latest' parentJobs: [] purpose: '' tagSet: 'CI' @@ -9,7 +9,7 @@ jobs: dependsOn: ${{ parameters.parentJobs }} pool: - name: ${{ parameters.pool }} + vmImage: ${{ parameters.pool }} displayName: Windows Test - ${{ parameters.purpose }} - ${{ parameters.tagSet }} diff --git a/.vsts-ci/windows-daily.yml b/.vsts-ci/windows-daily.yml index 9171112b3622..55470e6dd535 100644 --- a/.vsts-ci/windows-daily.yml +++ b/.vsts-ci/windows-daily.yml @@ -53,7 +53,7 @@ stages: jobs: - job: win_test pool: - vmImage: vs2017-win2016 + vmImage: windows-latest displayName: Windows Test timeoutInMinutes: 90 diff --git a/.vsts-ci/windows/templates/windows-packaging.yml b/.vsts-ci/windows/templates/windows-packaging.yml index 88a557ca032b..832fe73af5ed 100644 --- a/.vsts-ci/windows/templates/windows-packaging.yml +++ b/.vsts-ci/windows/templates/windows-packaging.yml @@ -1,6 +1,6 @@ parameters: - name: pool - default: 'Hosted VS2017' + default: 'windows-latest' - name: jobName default: 'win_packaging' - name: runtimePrefix @@ -24,7 +24,7 @@ jobs: value: $(Agent.BuildDirectory)\$(complianceRepoFolder) pool: - name: ${{ parameters.pool }} + vmImage: ${{ parameters.pool }} displayName: Windows Packaging - ${{ parameters.architecture }} - ${{ parameters.channel }} diff --git a/test/powershell/Modules/Microsoft.PowerShell.Core/CompatiblePSEditions.Module.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Core/CompatiblePSEditions.Module.Tests.ps1 index 72a7c9eddb15..22fba7453099 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Core/CompatiblePSEditions.Module.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Core/CompatiblePSEditions.Module.Tests.ps1 @@ -584,9 +584,14 @@ Describe "Additional tests for Import-Module with WinCompat" -Tag "Feature" { It "NoClobber WinCompat import works for an engine module through -UseWindowsPowerShell parameter" { + # pre-test cleanup + Get-Module -Name Microsoft.PowerShell.Management | Remove-Module + Import-Module -Name Microsoft.PowerShell.Management # import the one that comes with PSCore + Import-Module Microsoft.PowerShell.Management -UseWindowsPowerShell $modules = Get-Module -Name Microsoft.PowerShell.Management + $modules.Count | Should -Be 2 $proxyModule = $modules | Where-Object {$_.ModuleType -eq 'Script'} $coreModule = $modules | Where-Object {$_.ModuleType -eq 'Manifest'} @@ -656,6 +661,10 @@ Describe "Additional tests for Import-Module with WinCompat" -Tag "Feature" { Restore-ModulePath } + BeforeEach { + Get-PSSession -Name WinPSCompatSession -ErrorAction SilentlyContinue | Remove-PSSession + } + AfterEach { Get-Module $allModules | Remove-Module -Force } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1 index 3c7feafb1134..ac7ef02caba4 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1 @@ -1718,22 +1718,12 @@ Describe "Invoke-WebRequest tests" -Tags "Feature", "RequireAdminOnWindows" { ## Test cases for the 1st 'It' $testCases1 = @( @{ Test = @{SslProtocol = 'Default'; ActualProtocol = 'Default'}; Pending = $false } - @{ Test = @{SslProtocol = 'Tls'; ActualProtocol = 'Tls'}; Pending = $skipForTls1OnLinux } - @{ Test = @{SslProtocol = 'Tls11'; ActualProtocol = 'Tls11'}; Pending = $skipForTls1OnLinux } @{ Test = @{SslProtocol = 'Tls12'; ActualProtocol = 'Tls12'}; Pending = $false } @{ Test = @{SslProtocol = 'Tls13'; ActualProtocol = 'Tls13'}; Pending = $true } @{ Test = @{SslProtocol = 'Tls, Tls11, Tls12'; ActualProtocol = 'Tls12'}; Pending = $false } @{ Test = @{SslProtocol = 'Tls, Tls11, Tls12, Tls13'; ActualProtocol = 'Tls13'}; Pending = $true } @{ Test = @{SslProtocol = 'Tls11, Tls12'; ActualProtocol = 'Tls12'}; Pending = $false } - @{ Test = @{SslProtocol = 'Tls, Tls11, Tls12'; ActualProtocol = 'Tls11'}; Pending = $skipForTls1OnLinux } - @{ Test = @{SslProtocol = 'Tls, Tls11, Tls12, Tls13'; ActualProtocol = 'Tls11'}; Pending = $skipForTls1OnLinux } - @{ Test = @{SslProtocol = 'Tls11, Tls12'; ActualProtocol = 'Tls11'}; Pending = $skipForTls1OnLinux } - @{ Test = @{SslProtocol = 'Tls, Tls11'; ActualProtocol = 'Tls11'}; Pending = $skipForTls1OnLinux } - @{ Test = @{SslProtocol = 'Tls, Tls11, Tls12'; ActualProtocol = 'Tls'}; Pending = $skipForTls1OnLinux } - @{ Test = @{SslProtocol = 'Tls, Tls11, Tls13'; ActualProtocol = 'Tls'}; Pending = $true } - @{ Test = @{SslProtocol = 'Tls, Tls11'; ActualProtocol = 'Tls'}; Pending = $skipForTls1OnLinux } # Skipping intermediary protocols is not supported on all platforms - @{ Test = @{SslProtocol = 'Tls, Tls12'; ActualProtocol = 'Tls'}; Pending = -not $IsWindows } @{ Test = @{SslProtocol = 'Tls, Tls12'; ActualProtocol = 'Tls12'}; Pending = -not $IsWindows } ) @@ -3248,22 +3238,12 @@ Describe "Invoke-RestMethod tests" -Tags "Feature", "RequireAdminOnWindows" { $testCases1 = @( @{ Test = @{SslProtocol = 'Default'; ActualProtocol = 'Default'}; Pending = $false } - @{ Test = @{SslProtocol = 'Tls'; ActualProtocol = 'Tls'}; Pending = $skipForTls1OnLinux } - @{ Test = @{SslProtocol = 'Tls11'; ActualProtocol = 'Tls11'}; Pending = $skipForTls1OnLinux } @{ Test = @{SslProtocol = 'Tls12'; ActualProtocol = 'Tls12'}; Pending = $false } @{ Test = @{SslProtocol = 'Tls13'; ActualProtocol = 'Tls13'}; Pending = $true } @{ Test = @{SslProtocol = 'Tls, Tls11, Tls12'; ActualProtocol = 'Tls12'}; Pending = $false } @{ Test = @{SslProtocol = 'Tls, Tls11, Tls12, Tls13'; ActualProtocol = 'Tls13'}; Pending = $true } @{ Test = @{SslProtocol = 'Tls11, Tls12'; ActualProtocol = 'Tls12'}; Pending = $false } - @{ Test = @{SslProtocol = 'Tls, Tls11, Tls12'; ActualProtocol = 'Tls11'}; Pending = $skipForTls1OnLinux } - @{ Test = @{SslProtocol = 'Tls, Tls11, Tls12, Tls13'; ActualProtocol = 'Tls11'}; Pending = $skipForTls1OnLinux } - @{ Test = @{SslProtocol = 'Tls11, Tls12'; ActualProtocol = 'Tls11'}; Pending = $skipForTls1OnLinux } - @{ Test = @{SslProtocol = 'Tls, Tls11'; ActualProtocol = 'Tls11'}; Pending = $skipForTls1OnLinux } - @{ Test = @{SslProtocol = 'Tls, Tls11, Tls12'; ActualProtocol = 'Tls'}; Pending = $skipForTls1OnLinux } - @{ Test = @{SslProtocol = 'Tls, Tls11, Tls13'; ActualProtocol = 'Tls'}; Pending = $true } - @{ Test = @{SslProtocol = 'Tls, Tls11'; ActualProtocol = 'Tls'}; Pending = $skipForTls1OnLinux } # Skipping intermediary protocols is not supported on all platforms - @{ Test = @{SslProtocol = 'Tls, Tls12'; ActualProtocol = 'Tls'}; Pending = -not $IsWindows } @{ Test = @{SslProtocol = 'Tls, Tls12'; ActualProtocol = 'Tls12'}; Pending = -not $IsWindows } ) diff --git a/test/powershell/Modules/Microsoft.WSMan.Management/CredSSP.Tests.ps1 b/test/powershell/Modules/Microsoft.WSMan.Management/CredSSP.Tests.ps1 index e440c8093f85..0f13e8e6aad1 100644 --- a/test/powershell/Modules/Microsoft.WSMan.Management/CredSSP.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.WSMan.Management/CredSSP.Tests.ps1 @@ -1,5 +1,8 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. + +Import-Module HelpersCommon + Describe "CredSSP cmdlet tests" -Tags 'Feature','RequireAdminOnWindows' { BeforeAll { @@ -44,21 +47,27 @@ Describe "CredSSP cmdlet tests" -Tags 'Feature','RequireAdminOnWindows' { } It "Enable-WSManCredSSP works: " -Skip:($NotEnglish -or $IsToBeSkipped) -TestCases @( - @{params=@{Role="Client";DelegateComputer="*"};description="client"}, - @{params=@{Role="Server"};description="server"} + @{ params = @{ Role="Client"; DelegateComputer="*" }; description = "client"; expected = "The machine is configured to allow delegating fresh credentials to the following target\(s\):wsman/\*" }, + @{ params = @{ Role="Server" }; description = "server"; expected = "This computer is configured to receive credentials from a remote client computer" } ) { - param ($params) + param ($params, $description, $expected) + $c = Enable-WSManCredSSP @params -Force $c.CredSSP | Should -BeTrue - $c = Get-WSManCredSSP if ($params.Role -eq "Client") { - $c[0] | Should -Match "The machine is configured to allow delegating fresh credentials to the following target\(s\):wsman/\*" + Wait-UntilTrue -IntervalInMilliseconds 500 -sb { + $c = Get-WSManCredSSP + $c[0] -match $expected + } | Should -BeTrue -Because "WSManCredSSP should have been enabled to allow delegating fresh credentials to wsman/*, but it was not." } else { - $c[1] | Should -Match "This computer is configured to receive credentials from a remote client computer" + Wait-UntilTrue -IntervalInMilliseconds 500 -sb { + $c = Get-WSManCredSSP + $c[1] -match $expected + } | Should -BeTrue -Because "WSManCredSSP should have been enabled to allow receiving credentials from a remote client computer, but it was not." } }