Skip to content

Add support for running helix tests against built shared fx #16828

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 123 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
1dc754a
Turn on project templates for helix to see what blows up
HaoK Nov 4, 2019
d5f751d
Try to include shared fx in helix payload
HaoK Nov 9, 2019
df12fba
Update Helix.props
HaoK Nov 9, 2019
1372178
Update Microsoft.AspNetCore.Authentication.Core.Test.csproj
HaoK Nov 9, 2019
03952a5
Update Helix.props
HaoK Nov 9, 2019
71a97ea
Turn on template tests for helix
HaoK Nov 12, 2019
a6f5355
Update Helix.props
HaoK Nov 12, 2019
8cbcec0
Test correct output directory for node script
HaoK Nov 12, 2019
43e4461
Create InstallAppRuntime.ps1
HaoK Nov 12, 2019
d82c597
Update Helix.props
HaoK Nov 12, 2019
40ec31a
Update Helix.props
HaoK Nov 12, 2019
8af51de
Update ci.yml
HaoK Nov 12, 2019
c291b67
Force failure to get some logs
HaoK Nov 18, 2019
2786edc
Break test
HaoK Nov 18, 2019
56a4c2e
Update Helix.props
HaoK Nov 18, 2019
7bcadb2
Create installappruntime.sh
HaoK Nov 18, 2019
d0e84f1
Copy to shared fx to Microsoft.AspNetCore.App in root
HaoK Nov 19, 2019
63726b1
Install shared fx if found before running tests
HaoK Nov 19, 2019
1f05baf
Copy shared fx if found
HaoK Nov 19, 2019
c8418d9
Update Helix.props
HaoK Nov 19, 2019
c6af10c
Update runtests.cmd
HaoK Nov 20, 2019
e9f01e2
Update InstallAppRuntime.ps1
HaoK Nov 20, 2019
e9e8b09
Update installappruntime.sh
HaoK Nov 20, 2019
0ecda9d
Update InstallAppRuntime.ps1
HaoK Nov 20, 2019
2a07f0b
Update installappruntime.sh
HaoK Nov 20, 2019
782953a
Update installappruntime.sh
HaoK Nov 21, 2019
90bae46
Update InstallAppRuntime.ps1
HaoK Nov 22, 2019
626e81a
Update InstallAppRuntime.ps1
HaoK Nov 22, 2019
de0fe18
Update installappruntime.sh
HaoK Nov 22, 2019
15e858d
Update InstallAppRuntime.ps1
HaoK Nov 22, 2019
11e4ea8
Update installappruntime.sh
HaoK Nov 22, 2019
3dee8b0
Update installappruntime.sh
HaoK Nov 22, 2019
e4cac96
Update runtests.sh
HaoK Nov 22, 2019
e9d17d8
Update installappruntime.sh
HaoK Nov 23, 2019
c38f898
Update runtests.sh
HaoK Nov 23, 2019
b2613db
Update runtests.sh
HaoK Nov 23, 2019
99df82d
Update Helix.props
HaoK Nov 23, 2019
927d2d0
Update InstallAppRuntime.ps1
HaoK Nov 23, 2019
d60da6d
Update runtests.cmd
HaoK Nov 23, 2019
d5f473c
Update runtests.sh
HaoK Nov 23, 2019
b82c025
Update runtests.cmd
HaoK Dec 2, 2019
62edbb3
Update runtests.sh
HaoK Dec 2, 2019
74f9286
Update InstallAppRuntime.ps1
HaoK Dec 2, 2019
a95865a
Update runtests.cmd
HaoK Dec 2, 2019
495ee43
Update runtests.cmd
HaoK Dec 3, 2019
f7a8dd5
Always install shared fx for helix tests
HaoK Dec 3, 2019
1e7d5d2
Update Microsoft.AspNetCore.Authentication.Core.Test.csproj
HaoK Dec 3, 2019
01e256f
Update ProjectTemplates.Tests.csproj
HaoK Dec 3, 2019
e3e2ce8
Update AuthenticationServiceTests.cs
HaoK Dec 4, 2019
fb60dfd
Update installappruntime.sh
HaoK Jan 14, 2020
4a9cafb
Update runtests.cmd
HaoK Jan 28, 2020
cdc0cec
Cleanup
HaoK Jan 30, 2020
5f6bb8a
Pass in target framework version to install
HaoK Jan 30, 2020
82f6b71
Update installappruntime.sh
HaoK Jan 30, 2020
6465791
Update InstallAppRuntime.ps1
HaoK Jan 30, 2020
2b9cfce
restore
HaoK Feb 4, 2020
419ec20
Clean up shared fx build steps
HaoK Feb 4, 2020
dd5d764
Update Helix.props
HaoK Feb 4, 2020
2be9211
Update installappruntime.sh
HaoK Feb 4, 2020
815d336
Update InstallAppRuntime.ps1
HaoK Feb 4, 2020
87e8f10
Print out runtime contents
HaoK Feb 5, 2020
be1d67b
Tweaks
HaoK Feb 5, 2020
65e8904
x86 pieces are required
HaoK Feb 5, 2020
029148f
Update InstallAppRuntime.ps1
HaoK Feb 5, 2020
1cbe21a
Update TemplatePackageInstaller.cs
HaoK Feb 5, 2020
0aad54b
Update ci.yml
HaoK Feb 5, 2020
f709295
Include templates
HaoK Feb 5, 2020
fa2337c
Search for templates nupkgs only
HaoK Feb 5, 2020
3b73a98
Update Helix.props
HaoK Feb 5, 2020
3587793
Update TemplatePackageInstaller.cs
HaoK Feb 6, 2020
d28d0eb
Update InstallAppRuntime.ps1
HaoK Feb 6, 2020
1147ec7
Update runtests.cmd
HaoK Feb 6, 2020
ffc6c3d
Update Helix.props
HaoK Feb 6, 2020
425d2d2
Include templates packages in helix payloads
HaoK Feb 6, 2020
9e35b55
Only install aspnet runtime/templates when asked
HaoK Feb 6, 2020
3417691
Opt into aspnet runtime only for templates test
HaoK Feb 6, 2020
21eb87a
Update Helix.props
HaoK Feb 7, 2020
e4d039d
Comment out shared fx build to debug
HaoK Feb 10, 2020
b154815
Specify artifact logs
HaoK Feb 10, 2020
b97095b
Update TemplatePackageInstaller.cs
HaoK Feb 11, 2020
38cbffe
Merge branch 'master' into helix-sharedfx
HaoK Feb 11, 2020
c098d38
Fix hive path on helix
HaoK Feb 11, 2020
55b95d7
Fix paths
HaoK Feb 11, 2020
6ea8340
Update Project.cs
HaoK Feb 11, 2020
b58fb2d
Update ProjectFactoryFixture.cs
HaoK Feb 12, 2020
7547e7a
Fix stuff
HaoK Feb 12, 2020
3d07b4c
Fix folder resolution
HaoK Feb 12, 2020
c4f2bcc
Update ProcessEx.cs
HaoK Feb 13, 2020
1704910
Update ProcessEx.cs
HaoK Feb 13, 2020
e38a0a5
Update TemplatePackageInstaller.cs
HaoK Feb 13, 2020
d91f61d
Update Project.cs
HaoK Feb 13, 2020
c902007
Create nuget restore directory
HaoK Feb 13, 2020
c8b05dc
Update ProcessEx.cs
HaoK Feb 13, 2020
04c7bf0
Update runtests.sh
HaoK Feb 13, 2020
7be4e77
Update SeleniumStandaloneServer.cs
HaoK Feb 14, 2020
d4a767b
Set base helix path
HaoK Feb 14, 2020
785c64b
Set helix dir
HaoK Feb 14, 2020
5e40ec7
Use full path for templates directories
HaoK Feb 14, 2020
c215cb3
create logs dir
HaoK Feb 15, 2020
d42e3e4
Update runtests.sh
HaoK Feb 15, 2020
e33eb8c
Update Project.cs
HaoK Feb 15, 2020
3644935
Add skip on helix ref
HaoK Feb 18, 2020
7d05178
Skip EF tests for now
HaoK Feb 18, 2020
581dbe9
Skip EF tests
HaoK Feb 18, 2020
34b8d05
Skip EF tests
HaoK Feb 18, 2020
c4128d4
Skip EF tests
HaoK Feb 18, 2020
4b93786
Include all shipping packages for restore
HaoK Feb 18, 2020
c28b82f
Update IdentityUIPackageTest.cs
HaoK Feb 18, 2020
7f23917
Try to set nuget fallback packages dir
HaoK Feb 18, 2020
ccc5325
Try to set nuget restore dir
HaoK Feb 18, 2020
1dd3ed4
skip razor class lib
HaoK Feb 18, 2020
90f9629
Update WorkerTemplateTest.cs
HaoK Feb 18, 2020
f3cc4ba
Update runtests.sh
HaoK Feb 18, 2020
99921d7
Update runtests.cmd
HaoK Feb 19, 2020
c2df878
Update runtests.cmd
HaoK Feb 19, 2020
5fe430e
Try helix workitem root
HaoK Feb 19, 2020
647fa7d
Update runtests.cmd
HaoK Feb 19, 2020
6bed900
Update AngularTemplateTest.cs
HaoK Feb 19, 2020
8133a27
Update ReactTemplateTest.cs
HaoK Feb 19, 2020
dcdf5b0
Update BlazorWasmTemplateTest.cs
HaoK Feb 19, 2020
0523a29
Update ByteOrderMarkTest.cs
HaoK Feb 19, 2020
acda40b
Update BlazorWasmTemplateTest.cs
HaoK Feb 19, 2020
48932a8
Merge branch 'master' into helix-sharedfx
HaoK Feb 20, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 28 additions & 8 deletions .azure/pipelines/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ stages:
displayName: Build x64

# Build the x86 shared framework
# TODO: make it possible to build for one Windows architecture at a time
# This is going to actually build x86 native assets. See https://github.com/dotnet/aspnetcore/issues/7196
# This is going to actually build x86 native assets.
- script: ./build.cmd
-ci
-arch x86
Expand Down Expand Up @@ -582,9 +581,16 @@ stages:
agentOs: Windows
timeoutInMinutes: 180
steps:
- script: .\restore.cmd -ci
displayName: Restore
- script: .\build.cmd -ci -NoRestore -test -projects eng\helix\helix.proj /p:IsRequiredCheck=true /p:IsHelixJob=true /p:BuildAllProjects=true /p:BuildNative=true /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log -bl
# Build the shared framework
- script: ./build.cmd -ci -all -pack -arch x64 /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log /bl:artifacts/log/helix.build.x64.binlog
displayName: Build shared fx
# Build the x86 shared framework
# This is going to actually build x86 native assets.
- script: ./build.cmd -ci -arch x86 -pack -all -buildNative -noBuildJava /p:OnlyPackPlatformSpecificPackages=true /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log /bl:artifacts/log/helix.build.x86.binlog $(_BuildArgs)
displayName: Build x86 shared framework pieces
- script: ./src/ProjectTemplates/build.cmd -ci -pack -NoRestore -NoBuilddeps "/p:RunTemplateTests=true /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log /bl:artifacts/log/helix.template.pack.binlog"
displayName: Pack Templates
- script: .\build.cmd -ci -noBuildRepoTasks -noRestore -noBuild -test -projects eng\helix\helix.proj /p:IsRequiredCheck=true /p:IsHelixJob=true /p:BuildAllProjects=true /p:BuildNative=true /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log -bl
displayName: Run build.cmd helix target
env:
HelixApiAccessToken: $(HelixApiAccessToken) # Needed for internal queues
Expand All @@ -603,9 +609,23 @@ stages:
agentOs: Windows
timeoutInMinutes: 180
steps:
- script: .\restore.cmd -ci
displayName: Restore
- script: .\build.cmd -ci -NoRestore -test -projects eng\helix\helix.proj /p:IsHelixJob=true /p:IsHelixDaily=true /p:BuildAllProjects=true /p:BuildNative=true /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log -bl
- script: ./build.cmd -ci -all -pack -arch x64 /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log /bl:artifacts/log/helix.daily.build.x64.binlog
displayName: Build shared fx
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to have: If you only need one shared framework and it's the 64-bit one, suggest using 3 jobs instead of two: Build the x64 shared runtime, upload pipeline artifacts you need, then depend on that build in the two Helix jobs. Might also be able to use the x64 shared runtime job as a dependency for the Windows x64 / x86 job. (Question: Will we run any tests on x86 Helix agents or using the x86 Helix shared framework?)

Otherwise, comments above apply here too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we aren't doing that today with the templates tests building their own shared framework?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really. But, we're getting to the point where building the same Windows bits all over the place is just wasting time. Storage is the same because the packages will become artifacts in any case and the network bandwidth to download things isn't that high. My only real question is whether it's worth uploading the artifacts/bin/ folder as a new Windows-only pipeline artifact for use in the Windows Test job.

One slight complication: We don't create package artifacts for public builds from source. Use pipeline artifacts in that case.

As I said, this is nice to have. We can deal w/ the 5 or so Windows x64 builds separately if you prefer.

# Build the x86 shared framework
# This is going to actually build x86 native assets.
- script: ./build.cmd
-ci
-arch x86
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be 'x64' for 64-bit testing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only saw an x86 shared framework in the ci.yml, so I assume it doesn't matter?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Windows x64 / x86 build step's comments are a bit confusing. The first ./build.cmd invocation creates the x64 shared runtime. The second (commented) one adds just the x86-specific bits.

I'm surprised the tests succeeded with the x86 shared runtime. Does anything actually test using it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this is on by default so all the shared framework bits are getting copied onto the helix machines for every test, so it doesn't seem to be causing any issues.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point is the created x86 shared framework here may not be used at all because it's not the bitness the tests need. Not causing issues isn't the same thing as enabling the testing we need.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure what's the fix just specify arch x64?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest adding a test that won't run unless it executes against the expected shared framework. Maybe something that looks at the location of a loaded SharedFX assembly. That'll help show what's working (or not) here.

Put another way, I'd rather not see this new infrastructure need further changes as soon as we try to use it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is prerequisite work for template testing, I don't think we need to add a new test for that, the only reason we need this is because its a requirement for templates which will fail if they aren't running against latest shared framework bits.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewording what I said: This doesn't look like it should work. Need to show that it is working w/ Win x64 test.

But, sure, one way to do that would be to enable template tests in the same PR.

-pack
-all
-buildNative
-noBuildJava
/p:OnlyPackPlatformSpecificPackages=true
/p:ASPNETCORE_TEST_LOG_DIR=artifacts/log
/bl:artifacts/log/helix.daily.build.x86.binlog
$(_BuildArgs)
displayName: Build x86 shared framework pieces
- script: .\build.cmd -ci -noBuildRepoTasks -noRestore -noBuild -test -projects eng\helix\helix.proj /p:IsHelixJob=true /p:IsHelixDaily=true /p:BuildAllProjects=true /p:BuildNative=true /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log -bl
displayName: Run build.cmd helix target
env:
HelixApiAccessToken: $(HelixApiAccessToken) # Needed for internal queues
Expand Down
49 changes: 49 additions & 0 deletions eng/helix/content/InstallAppRuntime.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<#
.SYNOPSIS
Installs an AspNetCore shared framework on a machine
.DESCRIPTION
This script installs an AspNetCore shared framework on a machine
.PARAMETER AppRuntimePath
The path to the app runtime package to install.
.PARAMETER InstallDir
The directory to install the shared framework to.
.PARAMETER Framework
The framework directory to copy the shared framework from.
#>
param(
[Parameter(Mandatory = $true)]
$AppRuntimePath,

[Parameter(Mandatory = $true)]
$InstallDir,

[Parameter(Mandatory = $true)]
$Framework)

$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue' # Workaround PowerShell/PowerShell#2138

Set-StrictMode -Version 1

Write-Host "Extracting to $InstallDir"

$zipPackage = [io.path]::ChangeExtension($AppRuntimePath, ".zip")
Write-Host "Renaming to $zipPackage"
Rename-Item -Path $AppRuntimePath -NewName $zipPackage
if (Get-Command -Name 'Microsoft.PowerShell.Archive\Expand-Archive' -ErrorAction Ignore) {
# Use built-in commands where possible as they are cross-plat compatible
Microsoft.PowerShell.Archive\Expand-Archive -Path $zipPackage -DestinationPath ".\tmpRuntime" -Force
}
else {
Remove-Item ".\tmpRuntime" -Recurse -ErrorAction Ignore
# Fallback to old approach for old installations of PowerShell
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipPackage, ".\tmpRuntime")
}

Get-ChildItem -Path ".\tmpRuntime" -Recurse

Write-Host "Copying managed files to $InstallDir"
Copy-Item -Path ".\tmpRuntime\runtimes\win-x64\lib\$Framework\*" $InstallDir
Write-Host "Todo: Copying native files to $InstallDir"
# Copy-Item -Path ".\tmpRuntime\runtimes\win-x64\native\*" $InstallDir
4 changes: 2 additions & 2 deletions eng/helix/content/InstallNode.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ if (Get-Command "node.exe" -ErrorAction SilentlyContinue)
exit
}

if (Test-Path "$output_dir\node.exe")
if (Test-Path "$InstallDir\node.exe")
{
Write-Host "Node.exe found at $output_dir"
Write-Host "Node.exe found at $InstallDir"
exit
}

Expand Down
19 changes: 19 additions & 0 deletions eng/helix/content/installappruntime.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

# Cause the script to fail if any subcommand fails
set -e

appRuntimePath=$1
output_dir=$2
framework=$3
tmpDir=./tmpRuntime

echo "Installing shared framework from $appRuntimePath"
cp $appRuntimePath sharedFx.zip

mkdir -p $tmpDir
unzip sharedFx.zip -d $tmpDir
mkdir -p $output_dir
echo "Copying to $output_dir"
cp $tmpDir/runtimes/win-x64/lib/$framework/* $output_dir
cp $tmpDir/runtimes/win-x64/native/* $output_dir
15 changes: 15 additions & 0 deletions eng/helix/content/runtests.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,22 @@ set PATH=%DOTNET_ROOT%;%PATH%;%HELIX_CORRELATION_PAYLOAD%\node\bin
powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -useb 'https://dot.net/v1/dotnet-install.ps1'))) -Architecture %arch% -Version %sdkVersion% -InstallDir %DOTNET_ROOT%"
powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -useb 'https://dot.net/v1/dotnet-install.ps1'))) -Architecture %arch% -Runtime dotnet -Version %runtimeVersion% -InstallDir %DOTNET_ROOT%"

if EXIST ".\Microsoft.AspNetCore.App" (
echo "Found Microsoft.AspNetCore.App, copying to %DOTNET_ROOT%\shared\Microsoft.AspNetCore.App\%runtimeVersion%"
xcopy /i /y ".\Microsoft.AspNetCore.App" %DOTNET_ROOT%\shared\Microsoft.AspNetCore.App\%runtimeVersion%\
)

echo "Current Directory: %HELIX_WORKITEM_ROOT%"
set HELIX=%helixQueue%
set HELIX_DIR=%HELIX_WORKITEM_ROOT%
set NUGET_FALLBACK_PACKAGES=%HELIX_DIR%
set NUGET_RESTORE=%HELIX_DIR%\nugetRestore
echo "Setting HELIX_DIR: %HELIX_DIR%"
echo Creating nuget restore directory: %NUGET_RESTORE%
mkdir %NUGET_RESTORE%
mkdir logs

dir

%DOTNET_ROOT%\dotnet vstest %target% -lt >discovered.txt
find /c "Exception thrown" discovered.txt
Expand Down
15 changes: 15 additions & 0 deletions eng/helix/content/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1

# Used by SkipOnHelix attribute
export helix="$helix_queue_name"
export HELIX_DIR="$DIR"
export NUGET_FALLBACK_PACKAGES="$DIR"
export NUGET_RESTORE="$DIR/nugetRestore"
echo "Creating nugetRestore directory: $NUGET_RESTORE"
mkdir $NUGET_RESTORE
mkdir logs

ls -la

RESET="\033[0m"
RED="\033[0;31m"
Expand Down Expand Up @@ -82,6 +90,13 @@ if [ $? -ne 0 ]; then
done
fi

# Copy over any local shared fx if found
if [ -d "Microsoft.AspNetCore.App" ]
then
echo "Found Microsoft.AspNetCore.App directory, copying to $DOTNET_ROOT/shared/Microsoft.AspNetCore.App/$dotnet_runtime_version."
cp -r Microsoft.AspNetCore.App $DOTNET_ROOT/shared/Microsoft.AspNetCore.App/$dotnet_runtime_version
fi

if [ -e /proc/self/coredump_filter ]; then
# Include memory in private and shared file-backed mappings in the dump.
# This ensures that we can see disassembly from our shared libraries when
Expand Down
2 changes: 2 additions & 0 deletions eng/targets/Helix.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
<HelixUseArchive>false</HelixUseArchive>
<LoggingTestingDisableFileLogging Condition="'$(IsHelixJob)' == 'true'">false</LoggingTestingDisableFileLogging>
<NodeVersion>10.15.3</NodeVersion>
<AppRuntimeVersion>5.0.0-ci</AppRuntimeVersion>
<TestDependsOnAspNetRuntime>false</TestDependsOnAspNetRuntime>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
Expand Down
3 changes: 2 additions & 1 deletion src/ProjectTemplates/test/BlazorServerTemplateTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,10 @@ public async Task BlazorServerTemplateWorks_NoAuth()
}
}

[Theory]
[ConditionalTheory]
[InlineData(true)]
[InlineData(false)]
[SkipOnHelix("ef restore no worky")]
public async Task BlazorServerTemplateWorks_IndividualAuth(bool useLocalDB)
{
Project = await ProjectFactory.GetOrCreateProject("blazorserverindividual" + (useLocalDB ? "uld" : ""), Output);
Expand Down
4 changes: 3 additions & 1 deletion src/ProjectTemplates/test/BlazorWasmTemplateTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.E2ETesting;
using Microsoft.Extensions.CommandLineUtils;
using Microsoft.AspNetCore.Testing;
using OpenQA.Selenium;
using Templates.Test.Helpers;
using Xunit;
Expand Down Expand Up @@ -54,7 +55,8 @@ public async Task BlazorWasmStandaloneTemplate_Works()
TestBasicNavigation(project.ProjectName);
}

[Fact]
[ConditionalFact]
[SkipOnHelix("npm")]
public async Task BlazorWasmHostedTemplate_Works()
{
var project = await ProjectFactory.GetOrCreateProject("blazorhosted", Output);
Expand Down
7 changes: 5 additions & 2 deletions src/ProjectTemplates/test/ByteOrderMarkTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.IO;
using System.Linq;
using System.Text;
using Microsoft.AspNetCore.Testing;
using Xunit;
using Xunit.Abstractions;

Expand All @@ -19,7 +20,8 @@ public ByteOrderMarkTest(ITestOutputHelper output)
_output = output;
}

[Theory]
[ConditionalTheory]
[SkipOnHelix("missing files")]
[InlineData("Web.ProjectTemplates")]
[InlineData("Web.Spa.ProjectTemplates")]
public void JSAndJSONInAllTemplates_ShouldNotContainBOM(string projectName)
Expand Down Expand Up @@ -60,7 +62,8 @@ public void JSAndJSONInAllTemplates_ShouldNotContainBOM(string projectName)
Assert.False(filesWithBOMCharactersPresent);
}

[Fact]
[ConditionalFact]
[SkipOnHelix("missing files")]
public void RazorFilesInWebProjects_ShouldContainBOM()
{
var projectName = "Web.ProjectTemplates";
Expand Down
8 changes: 5 additions & 3 deletions src/ProjectTemplates/test/Helpers/ProcessEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
Expand Down Expand Up @@ -189,11 +190,12 @@ public void WaitForExit(bool assertSuccess, TimeSpan? timeSpan = null)
}
}

private static string GetNugetPackagesRestorePath() =>
typeof(ProcessEx).Assembly
private static string GetNugetPackagesRestorePath() => (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("NUGET_RESTORE")))
? typeof(ProcessEx).Assembly
.GetCustomAttributes<AssemblyMetadataAttribute>()
.First(attribute => attribute.Key == "TestPackageRestorePath")
.Value;
.Value
: Environment.GetEnvironmentVariable("NUGET_RESTORE");

public void Dispose()
{
Expand Down
29 changes: 14 additions & 15 deletions src/ProjectTemplates/test/Helpers/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@ public class Project
public static bool IsCIEnvironment => typeof(Project).Assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
.Any(a => a.Key == "ContinuousIntegrationBuild");

public static string ArtifactsLogDir => GetAssemblyMetadata("ArtifactsLogDir");
public static string ArtifactsLogDir => (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("HELIX_DIR")))
? GetAssemblyMetadata("ArtifactsLogDir")
: Path.Combine(Environment.GetEnvironmentVariable("HELIX_DIR"), "logs");

// FIGURE OUT EF PATH
public static string DotNetEfFullPath => (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("helix")))
? typeof(ProjectFactoryFixture).Assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
.First(attribute => attribute.Key == "DotNetEfFullPath")
.Value
: Path.Combine("NuGetPackageRoot", "dotnet-ef/$(DotnetEfPackageVersion)/tools/netcoreapp3.1/any/dotnet-ef.dll");

public SemaphoreSlim DotNetNewLock { get; set; }
public SemaphoreSlim NodeLock { get; set; }
Expand Down Expand Up @@ -295,15 +304,11 @@ private async Task<ProcessEx> RestoreAsync(ITestOutputHelper output, string work
}
}



internal async Task<ProcessEx> RunDotNetEfCreateMigrationAsync(string migrationName)
{
var assembly = typeof(ProjectFactoryFixture).Assembly;

var dotNetEfFullPath = assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
.First(attribute => attribute.Key == "DotNetEfFullPath")
.Value;

var args = $"\"{dotNetEfFullPath}\" --verbose --no-build migrations add {migrationName}";
var args = $"\"{DotNetEfFullPath}\" --verbose --no-build migrations add {migrationName}";

// Only run one instance of 'dotnet new' at once, as a workaround for
// https://github.com/aspnet/templating/issues/63
Expand All @@ -322,13 +327,7 @@ internal async Task<ProcessEx> RunDotNetEfCreateMigrationAsync(string migrationN

internal async Task<ProcessEx> RunDotNetEfUpdateDatabaseAsync()
{
var assembly = typeof(ProjectFactoryFixture).Assembly;

var dotNetEfFullPath = assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
.First(attribute => attribute.Key == "DotNetEfFullPath")
.Value;

var args = $"\"{dotNetEfFullPath}\" --verbose --no-build database update";
var args = $"\"{DotNetEfFullPath}\" --verbose --no-build database update";

// Only run one instance of 'dotnet new' at once, as a workaround for
// https://github.com/aspnet/templating/issues/63
Expand Down
6 changes: 4 additions & 2 deletions src/ProjectTemplates/test/Helpers/ProjectFactoryFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ public async Task<Project> GetOrCreateProject(string projectKey, ITestOutputHelp
}

private static string GetTemplateFolderBasePath(Assembly assembly) =>
assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
(string.IsNullOrEmpty(Environment.GetEnvironmentVariable("HELIX_DIR")))
? assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
.Single(a => a.Key == "TestTemplateCreationFolder")
.Value;
.Value
: Path.Combine(Environment.GetEnvironmentVariable("HELIX_DIR"), "Templates", "BaseFolder");

public void Dispose()
{
Expand Down
26 changes: 18 additions & 8 deletions src/ProjectTemplates/test/Helpers/TemplatePackageInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ internal static class TemplatePackageInstaller
"Microsoft.AspNetCore.Blazor.Templates",
};

public static string CustomHivePath { get; } = typeof(TemplatePackageInstaller)
.Assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
.Single(s => s.Key == "CustomTemplateHivePath").Value;

public static string CustomHivePath { get; } = (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("helix")))
? typeof(TemplatePackageInstaller)
.Assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
.Single(s => s.Key == "CustomTemplateHivePath").Value
: Path.Combine("Hives", ".templateEngine");

public static async Task EnsureTemplatingEngineInitializedAsync(ITestOutputHelper output)
{
await InstallerLock.WaitAsync();
Expand Down Expand Up @@ -81,11 +83,19 @@ public static async Task<ProcessEx> RunDotNetNew(ITestOutputHelper output, strin

private static async Task InstallTemplatePackages(ITestOutputHelper output)
{
var builtPackages = Directory.EnumerateFiles(
typeof(TemplatePackageInstaller).Assembly
string packagesDir;
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("helix")))
{
packagesDir = ".";
}
else
{
packagesDir = typeof(TemplatePackageInstaller).Assembly
.GetCustomAttributes<AssemblyMetadataAttribute>()
.Single(a => a.Key == "ArtifactsShippingPackagesDir").Value,
"*.nupkg")
.Single(a => a.Key == "ArtifactsShippingPackagesDir").Value;
}

var builtPackages = Directory.EnumerateFiles(packagesDir, "*Templates*.nupkg")
.Where(p => _templatePackages.Any(t => Path.GetFileName(p).StartsWith(t, StringComparison.OrdinalIgnoreCase)))
.ToArray();

Expand Down
Loading