From 46460f00709d59b811ad989582460b4f492b38db Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Mon, 2 Mar 2020 20:43:48 -0800 Subject: [PATCH] Revert "[Helix] Reenable some Templates tests 2.0 (#19383)" (#19519) This reverts commit 5e2a7726c63b7d6e4b6aca09bfac756679b0c000. --- eng/helix/content/runtests.cmd | 11 ------ eng/helix/content/runtests.sh | 14 -------- eng/targets/Helix.targets | 4 +-- src/ProjectTemplates/test/Helpers/Project.cs | 36 +++++-------------- .../test/IdentityUIPackageTest.cs | 4 ++- src/ProjectTemplates/test/MvcTemplateTest.cs | 6 ++-- .../test/RazorClassLibraryTemplateTest.cs | 4 ++- .../test/RazorPagesTemplateTest.cs | 6 ++-- .../test/WorkerTemplateTest.cs | 3 +- 9 files changed, 26 insertions(+), 62 deletions(-) diff --git a/eng/helix/content/runtests.cmd b/eng/helix/content/runtests.cmd index 4917f46c0e..73cf658c18 100644 --- a/eng/helix/content/runtests.cmd +++ b/eng/helix/content/runtests.cmd @@ -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% @@ -25,14 +24,6 @@ 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%" @@ -40,8 +31,6 @@ 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% diff --git a/eng/helix/content/runtests.sh b/eng/helix/content/runtests.sh index a82a5aa0f4..c31297d587 100644 --- a/eng/helix/content/runtests.sh +++ b/eng/helix/content/runtests.sh @@ -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" @@ -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 @@ -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 diff --git a/eng/targets/Helix.targets b/eng/targets/Helix.targets index 154ce92ee6..0084984353 100644 --- a/eng/targets/Helix.targets +++ b/eng/targets/Helix.targets @@ -120,8 +120,8 @@ Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj $(TargetFileName) @(HelixPreCommand) @(HelixPostCommand) - call runtests.cmd $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion) - ./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion) + call runtests.cmd $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) + ./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(HelixCommand) $(HelixTimeout) diff --git a/src/ProjectTemplates/test/Helpers/Project.cs b/src/ProjectTemplates/test/Helpers/Project.cs index 3fdcdf9d0c..28a9bdd917 100644 --- a/src/ProjectTemplates/test/Helpers/Project.cs +++ b/src/ProjectTemplates/test/Helpers/Project.cs @@ -7,7 +7,6 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; -using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.CommandLineUtils; @@ -29,11 +28,12 @@ namespace Templates.Test.Helpers ? 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() .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; } @@ -306,24 +306,14 @@ namespace Templates.Test.Helpers internal async Task 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; } @@ -335,24 +325,14 @@ namespace Templates.Test.Helpers internal async Task 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; } diff --git a/src/ProjectTemplates/test/IdentityUIPackageTest.cs b/src/ProjectTemplates/test/IdentityUIPackageTest.cs index deede64521..fe794a3629 100644 --- a/src/ProjectTemplates/test/IdentityUIPackageTest.cs +++ b/src/ProjectTemplates/test/IdentityUIPackageTest.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.IO; using System.Net; using System.Threading.Tasks; +using Microsoft.AspNetCore.Testing; using Templates.Test.Helpers; using Xunit; using Xunit.Abstractions; @@ -117,8 +118,9 @@ namespace Templates.Test "Identity/lib/jquery-validation-unobtrusive/LICENSE.txt", }; - [Theory] + [ConditionalTheory] [MemberData(nameof(MSBuildIdentityUIPackageOptions))] + [SkipOnHelix("ef restore no worky")] public async Task IdentityUIPackage_WorksWithDifferentOptions(IDictionary packageOptions, string versionValidator, string[] expectedFiles) { Project = await ProjectFactory.GetOrCreateProject("identityuipackage" + string.Concat(packageOptions.Values), Output); diff --git a/src/ProjectTemplates/test/MvcTemplateTest.cs b/src/ProjectTemplates/test/MvcTemplateTest.cs index 0dc0023bb9..271aed575b 100644 --- a/src/ProjectTemplates/test/MvcTemplateTest.cs +++ b/src/ProjectTemplates/test/MvcTemplateTest.cs @@ -104,9 +104,10 @@ namespace Templates.Test } } - [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); @@ -221,7 +222,8 @@ namespace Templates.Test } } - [Fact] + [ConditionalFact] + [SkipOnHelix("razor compilation restore no worky")] public async Task MvcTemplate_RazorRuntimeCompilation_BuildsAndPublishes() { Project = await ProjectFactory.GetOrCreateProject("mvc_rc", Output); diff --git a/src/ProjectTemplates/test/RazorClassLibraryTemplateTest.cs b/src/ProjectTemplates/test/RazorClassLibraryTemplateTest.cs index 0d02a56f8f..f8d6bd65b5 100644 --- a/src/ProjectTemplates/test/RazorClassLibraryTemplateTest.cs +++ b/src/ProjectTemplates/test/RazorClassLibraryTemplateTest.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Templates.Test.Helpers; using Xunit; using Xunit.Abstractions; +using Microsoft.AspNetCore.Testing; namespace Templates.Test { @@ -40,7 +41,8 @@ namespace Templates.Test 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); diff --git a/src/ProjectTemplates/test/RazorPagesTemplateTest.cs b/src/ProjectTemplates/test/RazorPagesTemplateTest.cs index a0a57e48a9..73e4a5da52 100644 --- a/src/ProjectTemplates/test/RazorPagesTemplateTest.cs +++ b/src/ProjectTemplates/test/RazorPagesTemplateTest.cs @@ -94,9 +94,10 @@ namespace Templates.Test } } - [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); @@ -211,7 +212,8 @@ namespace Templates.Test } } - [Fact] + [ConditionalFact] + [SkipOnHelix("runtime compliation restore no worky")] public async Task RazorPagesTemplate_RazorRuntimeCompilation_BuildsAndPublishes() { Project = await ProjectFactory.GetOrCreateProject("razorpages_rc", Output); diff --git a/src/ProjectTemplates/test/WorkerTemplateTest.cs b/src/ProjectTemplates/test/WorkerTemplateTest.cs index 0a3bca6568..0299f17a11 100644 --- a/src/ProjectTemplates/test/WorkerTemplateTest.cs +++ b/src/ProjectTemplates/test/WorkerTemplateTest.cs @@ -21,7 +21,8 @@ namespace Templates.Test public ProjectFactoryFixture ProjectFactory { get; } public ITestOutputHelper Output { get; } - [Fact] + [ConditionalFact] + [SkipOnHelix("restore no worky")] public async Task WorkerTemplateAsync() { Project = await ProjectFactory.GetOrCreateProject("worker", Output);