Skip to content

Remove retries from BlazorWasm template tests & don't fail on restore errors #37715

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
merged 2 commits into from
Oct 21, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
using Xunit;
using Xunit.Abstractions;

namespace Templates.Test
namespace BlazorTemplates.Tests
{
[Retry]
public class BlazorServerTemplateTest : BlazorTemplateTest
{
public BlazorServerTemplateTest(ProjectFactoryFixture projectFactory)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using Templates.Test.Helpers;
using Xunit;

namespace Templates.Test
namespace BlazorTemplates.Tests
{
public abstract class BlazorTemplateTest : BrowserTestBase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
using Xunit;
using Xunit.Abstractions;

namespace Templates.Test
namespace BlazorTemplates.Tests
{
[Retry]
public class BlazorWasmTemplateTest : BlazorTemplateTest
{
public BlazorWasmTemplateTest(ProjectFactoryFixture projectFactory)
Expand Down
3 changes: 2 additions & 1 deletion src/ProjectTemplates/Shared/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ internal async Task<ProcessResult> RunDotNetNewAsync(
string language = null,
bool useLocalDB = false,
bool noHttps = false,
bool errorOnRestoreError = true,
string[] args = null,
// Used to set special options in MSBuild
IDictionary<string, string> environmentVariables = null)
Expand Down Expand Up @@ -127,7 +128,7 @@ internal async Task<ProcessResult> RunDotNetNewAsync(
var result = new ProcessResult(execution);

// Because dotnet new automatically restores but silently ignores restore errors, need to handle restore errors explicitly
if (execution.Output.Contains("Restore failed.") || execution.Error.Contains("Restore failed."))
if (errorOnRestoreError && (execution.Output.Contains("Restore failed.") || execution.Error.Contains("Restore failed.")))
{
result.ExitCode = -1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ProjectTemplates/test/BlazorTemplateTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected async Task<Project> CreateBuildPublishAsync(string projectName, string
project.TargetFramework = targetFramework;
}

var createResult = await project.RunDotNetNewAsync(ProjectType, auth: auth, args: args);
var createResult = await project.RunDotNetNewAsync(ProjectType, auth: auth, args: args, errorOnRestoreError: false);
Assert.True(0 == createResult.ExitCode, ErrorMessages.GetFailedProcessMessage("create/restore", project, createResult));

if (!onlyCreate)
Expand Down