Skip to content

Revert "[Helix] Reenable some Templates tests 2.0 (#19383)" #19519

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

Merged
1 commit merged into from
Mar 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 0 additions & 11 deletions eng/helix/content/runtests.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ set $runtimeVersion=%3
set $helixQueue=%4
set $arch=%5
set $quarantined=%6
set $efVersion=%7

set DOTNET_HOME=%HELIX_CORRELATION_PAYLOAD%\sdk
set DOTNET_ROOT=%DOTNET_HOME%\%$arch%
Expand All @@ -25,23 +24,13 @@ powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePo
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 "Adding current directory to nuget sources: %HELIX_WORKITEM_ROOT%"
dotnet nuget add source %HELIX_WORKITEM_ROOT%
dotnet nuget add source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json
dotnet nuget list source
dotnet tool install dotnet-ef --global --version %$efVersion%

set PATH=%PATH%;%DOTNET_CLI_HOME%\.dotnet\tools
)

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
set DotNetEfFullPath=%HELIX_DIR%\nugetRestore\dotnet-ef\%$efVersion%\tools\netcoreapp3.1\any\dotnet-ef.exe
echo "Set DotNetEfFullPath: %DotNetEfFullPath%"
echo "Setting HELIX_DIR: %HELIX_DIR%"
echo Creating nuget restore directory: %NUGET_RESTORE%
mkdir %NUGET_RESTORE%
Expand Down
14 changes: 0 additions & 14 deletions eng/helix/content/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ dotnet_runtime_version="$3"
helix_queue_name="$4"
target_arch="$5"
quarantined="$6"
efVersion="$7"

RESET="\033[0m"
RED="\033[0;31m"
Expand Down Expand Up @@ -34,8 +33,6 @@ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export helix="$helix_queue_name"
export HELIX_DIR="$DIR"
export NUGET_FALLBACK_PACKAGES="$DIR"
export DotNetEfFullPath=$DIR\nugetRestore\dotnet-ef\$efVersion\tools\netcoreapp3.1\any\dotnet-ef.dll
echo "Set DotNetEfFullPath: $DotNetEfFullPath"
export NUGET_RESTORE="$DIR/nugetRestore"
echo "Creating nugetRestore directory: $NUGET_RESTORE"
mkdir $NUGET_RESTORE
Expand Down Expand Up @@ -98,17 +95,6 @@ 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

echo "Adding current directory to nuget sources: $DIR"
dotnet nuget add source $DIR
dotnet nuget add source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json
dotnet nuget list source

dotnet tool install dotnet-ef --global --version $efVersion

# Ensure tools are on on PATH
export PATH="$PATH:$DOTNET_CLI_HOME/.dotnet/tools"

fi

if [ -e /proc/self/coredump_filter ]; then
Expand Down
4 changes: 2 additions & 2 deletions eng/targets/Helix.targets
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj
<TestAssembly>$(TargetFileName)</TestAssembly>
<PreCommands>@(HelixPreCommand)</PreCommands>
<PostCommands>@(HelixPostCommand)</PostCommands>
<Command Condition="$(IsWindowsHelixQueue)">call runtests.cmd $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion)</Command>
<Command Condition="!$(IsWindowsHelixQueue)">./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion)</Command>
<Command Condition="$(IsWindowsHelixQueue)">call runtests.cmd $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests)</Command>
<Command Condition="!$(IsWindowsHelixQueue)">./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests)</Command>
<Command Condition="$(HelixCommand) != ''">$(HelixCommand)</Command>
<Timeout>$(HelixTimeout)</Timeout>
</HelixWorkItem>
Expand Down
36 changes: 8 additions & 28 deletions src/ProjectTemplates/test/Helpers/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.CommandLineUtils;
Expand All @@ -29,11 +28,12 @@ public class Project
? GetAssemblyMetadata("ArtifactsLogDir")
: Path.Combine(Environment.GetEnvironmentVariable("HELIX_DIR"), "logs");

public static string DotNetEfFullPath => (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("DotNetEfFullPath")))
// FIGURE OUT EF PATH
public static string DotNetEfFullPath => (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("helix")))
? typeof(ProjectFactoryFixture).Assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
.First(attribute => attribute.Key == "DotNetEfFullPath")
.Value
: Environment.GetEnvironmentVariable("DotNetEfFullPath");
: 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 @@ -306,24 +306,14 @@ private async Task<ProcessEx> RestoreAsync(ITestOutputHelper output, string work

internal async Task<ProcessEx> RunDotNetEfCreateMigrationAsync(string migrationName)
{
var args = $"--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
await DotNetNewLock.WaitAsync();
try
{
var command = DotNetMuxer.MuxerPathOrDefault();
if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("DotNetEfFullPath")))
{
args = $"\"{DotNetEfFullPath}\" " + args;
}
else
{
command = "dotnet-ef";
}

var result = ProcessEx.Run(Output, TemplateOutputDir, command, args);
var result = ProcessEx.Run(Output, TemplateOutputDir, DotNetMuxer.MuxerPathOrDefault(), args);
await result.Exited;
return result;
}
Expand All @@ -335,24 +325,14 @@ internal async Task<ProcessEx> RunDotNetEfCreateMigrationAsync(string migrationN

internal async Task<ProcessEx> RunDotNetEfUpdateDatabaseAsync()
{
var args = "--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
await DotNetNewLock.WaitAsync();
try
{
var command = DotNetMuxer.MuxerPathOrDefault();
if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("DotNetEfFullPath")))
{
args = $"\"{DotNetEfFullPath}\" " + args;
}
else
{
command = "dotnet-ef";
}

var result = ProcessEx.Run(Output, TemplateOutputDir, command, args);
var result = ProcessEx.Run(Output, TemplateOutputDir, DotNetMuxer.MuxerPathOrDefault(), args);
await result.Exited;
return result;
}
Expand Down
4 changes: 3 additions & 1 deletion src/ProjectTemplates/test/IdentityUIPackageTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.IO;
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Testing;
using Templates.Test.Helpers;
using Xunit;
using Xunit.Abstractions;
Expand Down Expand Up @@ -117,8 +118,9 @@ public static TheoryData<IDictionary<string, string>, string, string[]> MSBuildI
"Identity/lib/jquery-validation-unobtrusive/LICENSE.txt",
};

[Theory]
[ConditionalTheory]
[MemberData(nameof(MSBuildIdentityUIPackageOptions))]
[SkipOnHelix("ef restore no worky")]
public async Task IdentityUIPackage_WorksWithDifferentOptions(IDictionary<string, string> packageOptions, string versionValidator, string[] expectedFiles)
{
Project = await ProjectFactory.GetOrCreateProject("identityuipackage" + string.Concat(packageOptions.Values), Output);
Expand Down
6 changes: 4 additions & 2 deletions src/ProjectTemplates/test/MvcTemplateTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ private async Task MvcTemplateCore(string languageOverride)
}
}

[Theory]
[ConditionalTheory]
[InlineData(true)]
[InlineData(false)]
[SkipOnHelix("ef restore no worky")]
public async Task MvcTemplate_IndividualAuth(bool useLocalDB)
{
Project = await ProjectFactory.GetOrCreateProject("mvcindividual" + (useLocalDB ? "uld" : ""), Output);
Expand Down Expand Up @@ -221,7 +222,8 @@ public async Task MvcTemplate_IndividualAuth(bool useLocalDB)
}
}

[Fact]
[ConditionalFact]
[SkipOnHelix("razor compilation restore no worky")]
public async Task MvcTemplate_RazorRuntimeCompilation_BuildsAndPublishes()
{
Project = await ProjectFactory.GetOrCreateProject("mvc_rc", Output);
Expand Down
4 changes: 3 additions & 1 deletion src/ProjectTemplates/test/RazorClassLibraryTemplateTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Templates.Test.Helpers;
using Xunit;
using Xunit.Abstractions;
using Microsoft.AspNetCore.Testing;

namespace Templates.Test
{
Expand Down Expand Up @@ -40,7 +41,8 @@ public async Task RazorClassLibraryTemplate_WithViews_Async()
Assert.True(0 == buildResult.ExitCode, ErrorMessages.GetFailedProcessMessage("build", Project, buildResult));
}

[Fact]
[ConditionalFact]
[SkipOnHelix("restore no worky")]
public async Task RazorClassLibraryTemplateAsync()
{
Project = await ProjectFactory.GetOrCreateProject("razorclasslib", Output);
Expand Down
6 changes: 4 additions & 2 deletions src/ProjectTemplates/test/RazorPagesTemplateTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,10 @@ public async Task RazorPagesTemplate_NoAuth()
}
}

[Theory]
[ConditionalTheory]
[InlineData(false)]
[InlineData(true)]
[SkipOnHelix("ef restore no worky")]
public async Task RazorPagesTemplate_IndividualAuth(bool useLocalDB)
{
Project = await ProjectFactory.GetOrCreateProject("razorpagesindividual" + (useLocalDB ? "uld" : ""), Output);
Expand Down Expand Up @@ -211,7 +212,8 @@ public async Task RazorPagesTemplate_IndividualAuth(bool useLocalDB)
}
}

[Fact]
[ConditionalFact]
[SkipOnHelix("runtime compliation restore no worky")]
public async Task RazorPagesTemplate_RazorRuntimeCompilation_BuildsAndPublishes()
{
Project = await ProjectFactory.GetOrCreateProject("razorpages_rc", Output);
Expand Down
3 changes: 2 additions & 1 deletion src/ProjectTemplates/test/WorkerTemplateTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public WorkerTemplateTest(ProjectFactoryFixture projectFactory, ITestOutputHelpe
public ProjectFactoryFixture ProjectFactory { get; }
public ITestOutputHelper Output { get; }

[Fact]
[ConditionalFact]
[SkipOnHelix("restore no worky")]
public async Task WorkerTemplateAsync()
{
Project = await ProjectFactory.GetOrCreateProject("worker", Output);
Expand Down