Просмотр исходного кода

Fix Helix testing issues with stable versions and local builds (#25865)

- include all shipping packages in Helix payloads that need runtime
  - remove hard-coded `-ci` that broke Helix tests with stable versions or local builds
  - for local builds, do not assume `$(Configuration)` is Release
- support `$(HelixTargetQueues)` property used in RunHelix.ps1
  - lost somewhere along the lines; script ran full matrix

nits:
- clean up redundant addition of runtime and ref/ packages
  - `@(HelixContent)` additions in `_CreateHelixWorkItem` target are ignored
- mention '+' separation of `-HelixQueues` argument to RunHelix.ps1
- allow `$(IsUnitTestProject)` override in case we need it in the future
Doug Bunting 5 лет назад
Родитель
Сommit
e3b632894d

+ 1 - 1
Directory.Build.props

@@ -13,7 +13,7 @@
 
     <IsBenchmarkProject Condition="$(MSBuildProjectName.EndsWith('.Performance')) OR $(RepoRelativeProjectDir.Contains('perf')) OR $(RepoRelativeProjectDir.Contains('benchmarkapps'))">true</IsBenchmarkProject>
     <IsSpecificationTestProject Condition="$(MSBuildProjectName.EndsWith('.Specification.Tests'))">true</IsSpecificationTestProject>
-    <IsUnitTestProject>false</IsUnitTestProject>
+    <IsUnitTestProject Condition=" '$(IsUnitTestProject)' == '' ">false</IsUnitTestProject>
     <IsUnitTestProject Condition="'$(IsSpecificationTestProject)' != 'true' and ( $(MSBuildProjectName.EndsWith('Tests')) or $(MSBuildProjectName.EndsWith('.Test')) or $(MSBuildProjectName.EndsWith('.FunctionalTest')) )">true</IsUnitTestProject>
     <IsTestAssetProject Condition="$(RepoRelativeProjectDir.Contains('testassets'))">true</IsTestAssetProject>
     <IsSampleProject Condition="$(RepoRelativeProjectDir.Contains('sample'))">true</IsSampleProject>

+ 2 - 1
eng/helix/helix.proj

@@ -11,7 +11,8 @@
   <Import Project="..\targets\Helix.Common.props" />
   <Import Project="..\Build.props" />
 
-  <ItemGroup>
+  <!-- Microsoft.DotNet.Helix.Sdk.MultiQueue.targets splits $(HelixTargetQueues) into @(HelixTargetQueue) items. -->
+  <ItemGroup Condition=" '$(HelixTargetQueues)' == '' ">
     <HelixTargetQueue Condition="'$(_UseHelixOpenQueues)' == 'true'" Include="@(HelixAvailableTargetQueue)" />
     <HelixTargetQueue Condition="'$(_UseHelixOpenQueues)' != 'true'" Include="@(HelixAvailableTargetQueue->'%(Identity)'->Replace('.Open',''))" />
   </ItemGroup>

+ 1 - 1
eng/scripts/RunHelix.ps1

@@ -6,7 +6,7 @@
 .PARAMETER Project
     The test project to publish and send to Helix.
 .PARAMETER HelixQueues
-    Set the Helix queues to use, the list is ';' separated.
+    Set the Helix queues to use. The list is '+' or ';'-separated.
     Some supported queues:
     Ubuntu.1604.Amd64.Open
     Ubuntu.1804.Amd64.Open

+ 15 - 22
eng/targets/Helix.targets

@@ -16,8 +16,17 @@
     <HelixPreCommand Include="call RunPowershell.cmd InstallNode.ps1 $(NodeVersion) %25HELIX_CORRELATION_PAYLOAD%25\node\bin || exit /b 1" />
   </ItemGroup>
 
-  <ItemGroup Condition="'$(IsHelixJob)' == 'true' AND '$(TestDependsOnAspNetRuntime)' == 'true'">
-    <HelixContent Include="$(RepoRoot)artifacts\packages\Release\Shipping\*-ci.nupkg" />
+  <ItemGroup Condition=" '$(TestDependsOnAspNetRuntime)' == 'true' ">
+    <!-- Grab all shipping packages. -->
+    <HelixContent Include="$(RepoRoot)artifacts\packages\$(Configuration)\Shipping\*$(SharedFxVersion).nupkg" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <!-- Java test projects do not use xUnit. -->
+    <HelixContent Include="$(OutputPath)Microsoft.VisualStudio.TestPlatform.Extension.Xunit.Xml.TestAdapter.dll"
+        Condition=" EXISTS('$(OutputPath)Microsoft.VisualStudio.TestPlatform.Extension.Xunit.Xml.TestLogger.dll') " />
+    <HelixContent Include="$(OutputPath)Microsoft.VisualStudio.TestPlatform.Extension.Xunit.Xml.TestLogger.dll"
+        Condition=" EXISTS('$(OutputPath)Microsoft.VisualStudio.TestPlatform.Extension.Xunit.Xml.TestLogger.dll') " />
   </ItemGroup>
 
   <!-- Item group has to be defined here because Helix.props is evaluated before xunit.runner.console.props  -->
@@ -40,13 +49,10 @@
     </ContentWithTargetPath>
   </ItemGroup>
 
-<!--
-
-This target is meant to be used when invoking helix tests on one project at a time.
-
-Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj
-
--->
+  <!--
+    This target is meant to be used when invoking helix tests on one project at a time.
+    Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj
+  -->
   <Target Name="Helix">
     <MSBuild Projects="$(MSBuildThisFileDirectory)..\helix\helix.proj"
              Properties="ProjectToBuild=$(MSBuildProjectFullPath)" />
@@ -101,19 +107,6 @@ Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj
   </Target>
 
   <Target Name="_CreateHelixWorkItem" Condition="$(BuildHelixPayload)">
-    <ItemGroup>
-      <HelixContent Include="$(OutputPath)/Microsoft.VisualStudio.TestPlatform.Extension.Xunit.Xml.TestAdapter.dll" />
-      <HelixContent Include="$(OutputPath)/Microsoft.VisualStudio.TestPlatform.Extension.Xunit.Xml.TestLogger.dll" />
-    </ItemGroup>
-
-    <ItemGroup Condition=" '$(TestDependsOnAspNetRef)' == 'true' AND '$(IsTargetingPackBuilding)' == 'true' ">
-      <HelixContent Include="$(RepoRoot)artifacts\packages\Release\Shipping\Microsoft.AspNetCore.App.Ref.$(TargetingPackVersion).nupkg" />
-    </ItemGroup>
-
-    <ItemGroup Condition=" '$(TestDependsOnAspNetRuntime)' == 'true' ">
-      <HelixContent Include="$(RepoRoot)artifacts\packages\Release\Shipping\Microsoft.AspNetCore.App.Runtime.win-x64.$(SharedFxVersion).nupkg" />
-    </ItemGroup>
-
     <PropertyGroup>
       <!-- Extract the effective queue name from this format "(name)host@dockerimage". This is sometimes used in test code to skip tests.  -->
       <_HelixFriendlyNameTargetQueue>$(HelixTargetQueue)</_HelixFriendlyNameTargetQueue>

+ 0 - 1
src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj

@@ -5,7 +5,6 @@
     <RootNamespace>Microsoft.AspNetCore</RootNamespace>
     <VerifyAncmBinary Condition="'$(TargetOsName)' == 'win' AND '$(TargetArchitecture)' != 'arm'">true</VerifyAncmBinary>
     <TestDependsOnAspNetRuntime>true</TestDependsOnAspNetRuntime>
-    <TestDependsOnAspNetRef>true</TestDependsOnAspNetRef>
     <SkipHelixArm>true</SkipHelixArm>
   </PropertyGroup>