Skip to content

Commit 0ea2059

Browse files
committed
Revert "Revert "[Helix] Reenable some Templates tests 2.0 (#19383)" (#19519)"
This reverts commit 46460f0.
1 parent 7e72fb2 commit 0ea2059

File tree

9 files changed

+62
-26
lines changed

9 files changed

+62
-26
lines changed

eng/helix/content/runtests.cmd

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ set $runtimeVersion=%3
99
set $helixQueue=%4
1010
set $arch=%5
1111
set $quarantined=%6
12+
set $efVersion=%7
1213

1314
set DOTNET_HOME=%HELIX_CORRELATION_PAYLOAD%\sdk
1415
set DOTNET_ROOT=%DOTNET_HOME%\%$arch%
@@ -26,13 +27,23 @@ echo "Checking for Microsoft.AspNetCore.App"
2627
if EXIST ".\Microsoft.AspNetCore.App" (
2728
echo "Found Microsoft.AspNetCore.App, copying to %DOTNET_ROOT%\shared\Microsoft.AspNetCore.App\%runtimeVersion%"
2829
xcopy /i /y ".\Microsoft.AspNetCore.App" %DOTNET_ROOT%\shared\Microsoft.AspNetCore.App\%runtimeVersion%\
30+
31+
echo "Adding current directory to nuget sources: %HELIX_WORKITEM_ROOT%"
32+
dotnet nuget add source %HELIX_WORKITEM_ROOT%
33+
dotnet nuget add source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json
34+
dotnet nuget list source
35+
dotnet tool install dotnet-ef --global --version %$efVersion%
36+
37+
set PATH=%PATH%;%DOTNET_CLI_HOME%\.dotnet\tools
2938
)
3039

3140
echo "Current Directory: %HELIX_WORKITEM_ROOT%"
3241
set HELIX=%$helixQueue%
3342
set HELIX_DIR=%HELIX_WORKITEM_ROOT%
3443
set NUGET_FALLBACK_PACKAGES=%HELIX_DIR%
3544
set NUGET_RESTORE=%HELIX_DIR%\nugetRestore
45+
set DotNetEfFullPath=%HELIX_DIR%\nugetRestore\dotnet-ef\%$efVersion%\tools\netcoreapp3.1\any\dotnet-ef.exe
46+
echo "Set DotNetEfFullPath: %DotNetEfFullPath%"
3647
echo "Setting HELIX_DIR: %HELIX_DIR%"
3748
echo Creating nuget restore directory: %NUGET_RESTORE%
3849
mkdir %NUGET_RESTORE%

eng/helix/content/runtests.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ dotnet_runtime_version="$3"
66
helix_queue_name="$4"
77
target_arch="$5"
88
quarantined="$6"
9+
efVersion="$7"
910

1011
RESET="\033[0m"
1112
RED="\033[0;31m"
@@ -33,6 +34,8 @@ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
3334
export helix="$helix_queue_name"
3435
export HELIX_DIR="$DIR"
3536
export NUGET_FALLBACK_PACKAGES="$DIR"
37+
export DotNetEfFullPath=$DIR\nugetRestore\dotnet-ef\$efVersion\tools\netcoreapp3.1\any\dotnet-ef.dll
38+
echo "Set DotNetEfFullPath: $DotNetEfFullPath"
3639
export NUGET_RESTORE="$DIR/nugetRestore"
3740
echo "Creating nugetRestore directory: $NUGET_RESTORE"
3841
mkdir $NUGET_RESTORE
@@ -95,6 +98,17 @@ if [ -d "Microsoft.AspNetCore.App" ]
9598
then
9699
echo "Found Microsoft.AspNetCore.App directory, copying to $DOTNET_ROOT/shared/Microsoft.AspNetCore.App/$dotnet_runtime_version."
97100
cp -r Microsoft.AspNetCore.App $DOTNET_ROOT/shared/Microsoft.AspNetCore.App/$dotnet_runtime_version
101+
102+
echo "Adding current directory to nuget sources: $DIR"
103+
dotnet nuget add source $DIR
104+
dotnet nuget add source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json
105+
dotnet nuget list source
106+
107+
dotnet tool install dotnet-ef --global --version $efVersion
108+
109+
# Ensure tools are on on PATH
110+
export PATH="$PATH:$DOTNET_CLI_HOME/.dotnet/tools"
111+
98112
fi
99113

100114
if [ -e /proc/self/coredump_filter ]; then

eng/targets/Helix.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj
120120
<TestAssembly>$(TargetFileName)</TestAssembly>
121121
<PreCommands>@(HelixPreCommand)</PreCommands>
122122
<PostCommands>@(HelixPostCommand)</PostCommands>
123-
<Command Condition="$(IsWindowsHelixQueue)">call runtests.cmd $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests)</Command>
124-
<Command Condition="!$(IsWindowsHelixQueue)">./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests)</Command>
123+
<Command Condition="$(IsWindowsHelixQueue)">call runtests.cmd $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion)</Command>
124+
<Command Condition="!$(IsWindowsHelixQueue)">./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests) $(DotnetEfPackageVersion)</Command>
125125
<Command Condition="$(HelixCommand) != ''">$(HelixCommand)</Command>
126126
<Timeout>$(HelixTimeout)</Timeout>
127127
</HelixWorkItem>

src/ProjectTemplates/test/Helpers/Project.cs

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.IO;
88
using System.Linq;
99
using System.Reflection;
10+
using System.Runtime.InteropServices;
1011
using System.Threading;
1112
using System.Threading.Tasks;
1213
using Microsoft.Extensions.CommandLineUtils;
@@ -28,12 +29,11 @@ public class Project
2829
? GetAssemblyMetadata("ArtifactsLogDir")
2930
: Path.Combine(Environment.GetEnvironmentVariable("HELIX_DIR"), "logs");
3031

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

3838
public SemaphoreSlim DotNetNewLock { get; set; }
3939
public SemaphoreSlim NodeLock { get; set; }
@@ -306,14 +306,24 @@ private async Task<ProcessEx> RestoreAsync(ITestOutputHelper output, string work
306306

307307
internal async Task<ProcessEx> RunDotNetEfCreateMigrationAsync(string migrationName)
308308
{
309-
var args = $"\"{DotNetEfFullPath}\" --verbose --no-build migrations add {migrationName}";
310-
309+
var args = $"--verbose --no-build migrations add {migrationName}";
310+
311311
// Only run one instance of 'dotnet new' at once, as a workaround for
312312
// https://github.com/aspnet/templating/issues/63
313313
await DotNetNewLock.WaitAsync();
314314
try
315315
{
316-
var result = ProcessEx.Run(Output, TemplateOutputDir, DotNetMuxer.MuxerPathOrDefault(), args);
316+
var command = DotNetMuxer.MuxerPathOrDefault();
317+
if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("DotNetEfFullPath")))
318+
{
319+
args = $"\"{DotNetEfFullPath}\" " + args;
320+
}
321+
else
322+
{
323+
command = "dotnet-ef";
324+
}
325+
326+
var result = ProcessEx.Run(Output, TemplateOutputDir, command, args);
317327
await result.Exited;
318328
return result;
319329
}
@@ -325,14 +335,24 @@ internal async Task<ProcessEx> RunDotNetEfCreateMigrationAsync(string migrationN
325335

326336
internal async Task<ProcessEx> RunDotNetEfUpdateDatabaseAsync()
327337
{
328-
var args = $"\"{DotNetEfFullPath}\" --verbose --no-build database update";
338+
var args = "--verbose --no-build database update";
329339

330340
// Only run one instance of 'dotnet new' at once, as a workaround for
331341
// https://github.com/aspnet/templating/issues/63
332342
await DotNetNewLock.WaitAsync();
333343
try
334344
{
335-
var result = ProcessEx.Run(Output, TemplateOutputDir, DotNetMuxer.MuxerPathOrDefault(), args);
345+
var command = DotNetMuxer.MuxerPathOrDefault();
346+
if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("DotNetEfFullPath")))
347+
{
348+
args = $"\"{DotNetEfFullPath}\" " + args;
349+
}
350+
else
351+
{
352+
command = "dotnet-ef";
353+
}
354+
355+
var result = ProcessEx.Run(Output, TemplateOutputDir, command, args);
336356
await result.Exited;
337357
return result;
338358
}

src/ProjectTemplates/test/IdentityUIPackageTest.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System.IO;
66
using System.Net;
77
using System.Threading.Tasks;
8-
using Microsoft.AspNetCore.Testing;
98
using Templates.Test.Helpers;
109
using Xunit;
1110
using Xunit.Abstractions;
@@ -118,9 +117,8 @@ public static TheoryData<IDictionary<string, string>, string, string[]> MSBuildI
118117
"Identity/lib/jquery-validation-unobtrusive/LICENSE.txt",
119118
};
120119

121-
[ConditionalTheory]
120+
[Theory]
122121
[MemberData(nameof(MSBuildIdentityUIPackageOptions))]
123-
[SkipOnHelix("ef restore no worky")]
124122
public async Task IdentityUIPackage_WorksWithDifferentOptions(IDictionary<string, string> packageOptions, string versionValidator, string[] expectedFiles)
125123
{
126124
Project = await ProjectFactory.GetOrCreateProject("identityuipackage" + string.Concat(packageOptions.Values), Output);

src/ProjectTemplates/test/MvcTemplateTest.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,9 @@ private async Task MvcTemplateCore(string languageOverride)
104104
}
105105
}
106106

107-
[ConditionalTheory]
107+
[Theory]
108108
[InlineData(true)]
109109
[InlineData(false)]
110-
[SkipOnHelix("ef restore no worky")]
111110
public async Task MvcTemplate_IndividualAuth(bool useLocalDB)
112111
{
113112
Project = await ProjectFactory.GetOrCreateProject("mvcindividual" + (useLocalDB ? "uld" : ""), Output);
@@ -222,8 +221,7 @@ public async Task MvcTemplate_IndividualAuth(bool useLocalDB)
222221
}
223222
}
224223

225-
[ConditionalFact]
226-
[SkipOnHelix("razor compilation restore no worky")]
224+
[Fact]
227225
public async Task MvcTemplate_RazorRuntimeCompilation_BuildsAndPublishes()
228226
{
229227
Project = await ProjectFactory.GetOrCreateProject("mvc_rc", Output);

src/ProjectTemplates/test/RazorClassLibraryTemplateTest.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using Templates.Test.Helpers;
66
using Xunit;
77
using Xunit.Abstractions;
8-
using Microsoft.AspNetCore.Testing;
98

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

44-
[ConditionalFact]
45-
[SkipOnHelix("restore no worky")]
43+
[Fact]
4644
public async Task RazorClassLibraryTemplateAsync()
4745
{
4846
Project = await ProjectFactory.GetOrCreateProject("razorclasslib", Output);

src/ProjectTemplates/test/RazorPagesTemplateTest.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,9 @@ public async Task RazorPagesTemplate_NoAuth()
9494
}
9595
}
9696

97-
[ConditionalTheory]
97+
[Theory]
9898
[InlineData(false)]
9999
[InlineData(true)]
100-
[SkipOnHelix("ef restore no worky")]
101100
public async Task RazorPagesTemplate_IndividualAuth(bool useLocalDB)
102101
{
103102
Project = await ProjectFactory.GetOrCreateProject("razorpagesindividual" + (useLocalDB ? "uld" : ""), Output);
@@ -212,8 +211,7 @@ public async Task RazorPagesTemplate_IndividualAuth(bool useLocalDB)
212211
}
213212
}
214213

215-
[ConditionalFact]
216-
[SkipOnHelix("runtime compliation restore no worky")]
214+
[Fact]
217215
public async Task RazorPagesTemplate_RazorRuntimeCompilation_BuildsAndPublishes()
218216
{
219217
Project = await ProjectFactory.GetOrCreateProject("razorpages_rc", Output);

src/ProjectTemplates/test/WorkerTemplateTest.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ public WorkerTemplateTest(ProjectFactoryFixture projectFactory, ITestOutputHelpe
2121
public ProjectFactoryFixture ProjectFactory { get; }
2222
public ITestOutputHelper Output { get; }
2323

24-
[ConditionalFact]
25-
[SkipOnHelix("restore no worky")]
24+
[Fact]
2625
public async Task WorkerTemplateAsync()
2726
{
2827
Project = await ProjectFactory.GetOrCreateProject("worker", Output);

0 commit comments

Comments
 (0)