Skip to content

Commit 5a642a5

Browse files
authored
Merge pull request Azure#10586 from VeryEarly/upgrade-test-framework
Upgrade test framework (alternative for Azure#10500)
2 parents 1f373a5 + 769e392 commit 5a642a5

File tree

10 files changed

+37
-12
lines changed

10 files changed

+37
-12
lines changed

.azure-pipelines/powershell-core.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ variables:
55
LinuxImage: ubuntu-18.04
66
MacOSName: macOS
77
MacOSImage: macOS-10.13
8-
TestFramework: netcoreapp2.1
8+
TestFramework: netcoreapp2.2
99
TestTarget: Test
1010
Configuration: Debug
1111

.azure-pipelines/windows-powershell.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
variables:
22
WindowsName: windows
33
WindowsImage: VS2017-Win2016
4-
TestFramework: net472
5-
TestTarget: TestNet472
4+
TestFramework: netcoreapp2.2
5+
TestTarget: Test
66
Configuration: Debug
77

88
jobs:

build.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<!-- General -->
3030
<Configuration Condition="'$(Configuration)' != 'Release'">Debug</Configuration>
3131
<Scope Condition="$(Scope) == ''">All</Scope>
32-
<TestFramework Condition="'$(TestFramework)' == ''">netcoreapp2.1</TestFramework>
32+
<TestFramework Condition="'$(TestFramework)' == ''">netcoreapp2.2</TestFramework>
3333

3434
<!-- Flags -->
3535
<CodeSign Condition ="'$(CodeSign)' == ''">false</CodeSign>

src/Automation/Automation.Test/Automation.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<PropertyGroup>
1010
<RootNamespace>$(LegacyAssemblyPrefix)$(PsModuleName)$(AzTestAssemblySuffix)</RootNamespace>
1111
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
12-
<TargetFrameworks>netcoreapp2.0;netcoreapp2.1</TargetFrameworks>
12+
<TargetFrameworks>netcoreapp2.2;netcoreapp2.1</TargetFrameworks>
1313
</PropertyGroup>
1414

1515
<ItemGroup>

src/Az.Test.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<!-- Build -->
1313
<PropertyGroup>
14-
<TargetFrameworks>netcoreapp2.1;netcoreapp2.0;netstandard2.0</TargetFrameworks>
14+
<TargetFrameworks>netcoreapp2.2;netcoreapp2.1;netstandard2.0</TargetFrameworks>
1515
<AssemblyName>$(AzAssemblyPrefix)$(PsModuleName)$(AzTestAssemblySuffix)</AssemblyName>
1616
<RootNamespace>$(AzAssemblyPrefix)$(PsModuleName)$(AzTestAssemblySuffix)</RootNamespace>
1717
<IsPackable>false</IsPackable>

src/Sql/Sql.Test/Utilities/UnitTestHelper.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,14 @@ public static void CheckConfirmImpact(Type cmdlet, ConfirmImpact confirmImpact)
3434
object[] cmdletAttributes = cmdlet.GetCustomAttributes(typeof(CmdletAttribute), true);
3535
Assert.Single(cmdletAttributes);
3636
CmdletAttribute attribute = (CmdletAttribute)cmdletAttributes[0];
37-
Assert.Equal(confirmImpact, attribute.ConfirmImpact);
37+
if(attribute.SupportsShouldProcess)
38+
{
39+
Assert.Equal(confirmImpact, attribute.ConfirmImpact);
40+
}else
41+
{
42+
Assert.Equal(ConfirmImpact.None, attribute.ConfirmImpact);
43+
}
44+
3845
}
3946

4047
/// <summary>

src/SqlVirtualMachine/SqlVirtualMachine.Test/Utilities/UnitTestHelper.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ public static void CheckConfirmImpact(Type cmdlet, ConfirmImpact confirmImpact)
2828
object[] cmdletAttributes = cmdlet.GetCustomAttributes(typeof(CmdletAttribute), true);
2929
Assert.Single(cmdletAttributes);
3030
CmdletAttribute attribute = (CmdletAttribute)cmdletAttributes[0];
31-
Assert.Equal(confirmImpact, attribute.ConfirmImpact);
31+
if(attribute.SupportsShouldProcess)
32+
{
33+
Assert.Equal(confirmImpact, attribute.ConfirmImpact);
34+
}else
35+
{
36+
Assert.Equal(ConfirmImpact.None, attribute.ConfirmImpact);
37+
}
3238
}
3339

3440
public static void CheckCmdletModifiesData(Type cmdlet, bool supportsShouldProcess)

src/Storage/Storage.Test/Storage.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<PropertyGroup>
1111
<RootNamespace>Microsoft.WindowsAzure.Management.$(PsModuleName)$(AzTestAssemblySuffix)</RootNamespace>
12-
<TargetFrameworks>netcoreapp2.0;netcoreapp2.1</TargetFrameworks>
12+
<TargetFrameworks>netcoreapp2.2;netcoreapp2.1</TargetFrameworks>
1313
</PropertyGroup>
1414

1515
<ItemGroup>

src/Websites/Websites.Test/ScenarioTests/WebAppTests.ps1

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -710,21 +710,27 @@ function Test-WindowsContainerCanIssueWebAppPSSession
710710
$messageDNS = "Connecting to remote server $wname.azurewebsites.net failed with the following error message : The WinRM client cannot process the request because the server name cannot be resolved"
711711
$messageUnavailable = "Connecting to remote server $wname.azurewebsites.net failed with the following error message : The WinRM client sent a request to an HTTP server and got a response saying the requested HTTP URL was not available."
712712
$messagePsVersionNotSupported = "Remote Powershell sessions into Windows Containers on App Service from this version of PowerShell is not supported.";
713+
$messageMIResulFailed = "Connecting to remote server $wname.azurewebsites.net failed with the following error message : MI_RESULT_FAILED";
714+
$messageWSManNotInstalled = "This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system";
713715

714716
# One possible warning message in Playback mode.
715717
$messageWSMANNotConfigured = "Your current WSMAN Trusted Hosts settings will prevent you from connecting to your Container Web App";
716718

717719
$resultError = ($Error[0] -like "*$($messageDNS)*") -or
718720
($Error[0] -like "*$($messageUnavailable)*") -or
719721
($Error[0] -like "*$($messageWSMANNotConfigured)*") -or
720-
($Error[0] -like "*$($messagePsVersionNotSupported)*")
721-
722+
($Error[0] -like "*$($messagePsVersionNotSupported)*") -or
723+
($Error[0] -like "*$($messageMIResulFailed)*") -or
724+
($Error[0] -like "*$($messageWSManNotInstalled)*")
725+
722726
$resultWarning = ($wv[0] -like "*$($messageWSMANNotConfigured)*")
723727

724728
Write-Debug "Expected error message 1: $messageDNS"
725729
Write-Debug "Expected error message 2: $messageUnavailable"
726730
Write-Debug "Expected error message 3: $messagePsVersionNotSupported"
727-
731+
Write-Debug "Expected error message 4: $messageMIResulFailed"
732+
Write-Debug "Expected error message 5: $messageWSManNotInstalled"
733+
728734
Write-Debug "Expected Warning message 1: $messageWSMANNotConfigured"
729735

730736

tools/Common.Netcore.Dependencies.Test.targets

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@
4646
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
4747
</ItemGroup>
4848

49+
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.2'">
50+
<PackageReference Include="Microsoft.PowerShell.SDK" Version="6.2.3" IncludeAssets="All" />
51+
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
52+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
53+
</ItemGroup>
54+
4955
<ItemGroup>
5056
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="3.19.2" />
5157
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />

0 commit comments

Comments
 (0)