Parcourir la source

Enable SpaServices tests on helix (#29247)

* Update InstallNode.ps1

* Update runtests.cmd

* Update Helix.targets

* Update Microsoft.AspNetCore.SpaServices.Extensions.Tests.csproj

* Update InstallNode.ps1

* Update InstallNode.ps1

* Update helix-matrix.yml

* Update Microsoft.AspNetCore.SpaServices.Extensions.Tests.csproj

* Update Microsoft.AspNetCore.SpaServices.Extensions.Tests.csproj

* Skip on alpine

* Update helix-matrix.yml
Hao Kung il y a 5 ans
Parent
commit
699b80f5c2

+ 5 - 12
eng/helix/content/InstallNode.ps1

@@ -5,21 +5,17 @@
      This script installs NodeJs from http://nodejs.org/dist on a machine. 
      This script installs NodeJs from http://nodejs.org/dist on a machine. 
  .PARAMETER Version
  .PARAMETER Version
      The version of NodeJS to install.
      The version of NodeJS to install.
- .PARAMETER InstallDir
-     The directory to install NodeJS to.
  .LINK 
  .LINK 
      https://nodejs.org/en/
      https://nodejs.org/en/
  #> 
  #> 
 param(
 param(
     [Parameter(Mandatory = $true)]
     [Parameter(Mandatory = $true)]
-    $Version,
-    
-    [Parameter(Mandatory = $true)]
-    $InstallDir
+    $Version
 )
 )
 
 
 $ErrorActionPreference = 'Stop'
 $ErrorActionPreference = 'Stop'
 $ProgressPreference = 'SilentlyContinue' # Workaround PowerShell/PowerShell#2138
 $ProgressPreference = 'SilentlyContinue' # Workaround PowerShell/PowerShell#2138
+$InstallDir = $PSScriptRoot + '\nodejs' # Always install to workitem root / nodejs
 
 
 Set-StrictMode -Version 1
 Set-StrictMode -Version 1
 
 
@@ -31,7 +27,7 @@ if (Get-Command "node.exe" -ErrorAction SilentlyContinue)
 
 
 if (Test-Path "$InstallDir\node.exe")
 if (Test-Path "$InstallDir\node.exe")
 {
 {
-    Write-Host "Node.exe found at $InstallDir"
+    Write-Host "Node.exe found at $InstallDir\node.exe"
     exit
     exit
 }
 }
 
 
@@ -57,11 +53,8 @@ else {
     [System.IO.Compression.ZipFile]::ExtractToDirectory("nodejs.zip", $tempDir)
     [System.IO.Compression.ZipFile]::ExtractToDirectory("nodejs.zip", $tempDir)
 }
 }
 
 
-Write-Host "Expanded NodeJs"
-New-Item -Path "$InstallDir" -ItemType "directory" -Force
-Write-Host "Copying $tempDir\$nodeFile\node.exe to $InstallDir"
-Copy-Item "$tempDir\$nodeFile\node.exe" "$InstallDir\node.exe"
-
+Write-Host "Expanded NodeJs to $tempDir, moving $tempDir\$nodeFile to $InstallDir subdir"
+move $tempDir\$nodeFile $InstallDir
 if (Test-Path "$InstallDir\node.exe")
 if (Test-Path "$InstallDir\node.exe")
 {
 {
     Write-Host "Node.exe copied to $InstallDir"
     Write-Host "Node.exe copied to $InstallDir"

+ 1 - 1
eng/helix/content/runtests.cmd

@@ -21,7 +21,7 @@ set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
 set DOTNET_MULTILEVEL_LOOKUP=0
 set DOTNET_MULTILEVEL_LOOKUP=0
 set DOTNET_CLI_HOME=%CD%\home%random%
 set DOTNET_CLI_HOME=%CD%\home%random%
 
 
-set "PATH=%DOTNET_ROOT%;%PATH%;%HELIX_CORRELATION_PAYLOAD%\node\bin"
+set "PATH=%DOTNET_ROOT%;%PATH%;%CD%\nodejs"
 echo Set path to: "%PATH%"
 echo Set path to: "%PATH%"
 echo.
 echo.
 
 

+ 1 - 1
eng/targets/Helix.targets

@@ -13,7 +13,7 @@
   </ItemGroup>
   </ItemGroup>
 
 
   <ItemGroup Condition="'$(TestDependsOnNode)' == 'true' AND '$(IsWindowsHelixQueue)' == 'true'">
   <ItemGroup Condition="'$(TestDependsOnNode)' == 'true' AND '$(IsWindowsHelixQueue)' == 'true'">
-    <HelixPreCommand Include="call RunPowershell.cmd InstallNode.ps1 $(NodeVersion) %25HELIX_CORRELATION_PAYLOAD%25\node\bin || exit /b 1" />
+    <HelixPreCommand Include="call RunPowershell.cmd InstallNode.ps1 $(NodeVersion) || exit /b 1" />
   </ItemGroup>
   </ItemGroup>
 
 
   <ItemGroup Condition=" '$(TestDependsOnAspNetRuntime)' == 'true' ">
   <ItemGroup Condition=" '$(TestDependsOnAspNetRuntime)' == 'true' ">

+ 1 - 3
src/Middleware/SpaServices.Extensions/test/Microsoft.AspNetCore.SpaServices.Extensions.Tests.csproj

@@ -3,9 +3,7 @@
   <PropertyGroup>
   <PropertyGroup>
     <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
     <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
     <TestDependsOnNode>true</TestDependsOnNode>
     <TestDependsOnNode>true</TestDependsOnNode>
-	<!-- Depends on npm which is not picked up on helix -->
-    <!-- https://github.com/dotnet/aspnetcore/issues/18672 -->
-	<BuildHelixPayload>false</BuildHelixPayload>
+    <SkipHelixArm>true</SkipHelixArm>
   </PropertyGroup>
   </PropertyGroup>
 
 
   <ItemGroup>
   <ItemGroup>

+ 4 - 2
src/Middleware/SpaServices.Extensions/test/SpaServicesExtensionsTests.cs

@@ -38,7 +38,8 @@ namespace Microsoft.AspNetCore.SpaServices.Extensions.Tests
             Assert.Equal("No RootPath was set on the SpaStaticFilesOptions.", exception.Message);
             Assert.Equal("No RootPath was set on the SpaStaticFilesOptions.", exception.Message);
         }
         }
 
 
-        [Fact]
+        [ConditionalFact]
+        [SkipOnHelix("Flaky on Alpine", Queues = "(Alpine.312.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:alpine-3.12-helix-20200908125345-56c6673")]
         public async Task UseSpa_KillsRds_WhenAppIsStopped()
         public async Task UseSpa_KillsRds_WhenAppIsStopped()
         {
         {
             var serviceProvider = GetServiceProvider(s => s.RootPath = "/");
             var serviceProvider = GetServiceProvider(s => s.RootPath = "/");
@@ -57,7 +58,8 @@ namespace Microsoft.AspNetCore.SpaServices.Extensions.Tests
             await Assert_NpmKilled_WhenAppIsStopped(applicationLifetime, listener);
             await Assert_NpmKilled_WhenAppIsStopped(applicationLifetime, listener);
         }
         }
 
 
-        [Fact]
+        [ConditionalFact]
+        [SkipOnHelix("Flaky on Alpine", Queues = "(Alpine.312.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:alpine-3.12-helix-20200908125345-56c6673")]
         public async Task UseSpa_KillsAngularCli_WhenAppIsStopped()
         public async Task UseSpa_KillsAngularCli_WhenAppIsStopped()
         {
         {
             var serviceProvider = GetServiceProvider(s => s.RootPath = "/");
             var serviceProvider = GetServiceProvider(s => s.RootPath = "/");