Skip to content
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

Port a set of test fixes from main to 9.0.2xx #45549

Open
wants to merge 5 commits into
base: release/9.0.2xx
Choose a base branch
from
Open
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 @@ -39,7 +39,7 @@ public void CanBuildProjectWithPackageReferencesWithConflictingTypes()
var testAsset = _testAssetsManager.CreateTestProject(testProject);

var packagesPaths = packageReferences.Select(e => Path.GetDirectoryName(e.NupkgPath));
List<string> sources = new() { NuGetConfigWriter.DotnetCoreBlobFeed };
List<string> sources = new();
sources.AddRange(packagesPaths);
NuGetConfigWriter.Write(testAsset.TestRoot, sources);

Expand Down Expand Up @@ -85,7 +85,7 @@ public void CanBuildProjectWithMultiplePackageReferencesWithAliases()
testProject.SourceFiles[$"{testProject.Name}.cs"] = ClassLibAandBUsage;
var testAsset = _testAssetsManager.CreateTestProject(testProject);

List<string> sources = new() { NuGetConfigWriter.DotnetCoreBlobFeed, Path.GetDirectoryName(packageReferenceA.NupkgPath), Path.GetDirectoryName(packageReferenceB.NupkgPath) };
List<string> sources = new() { Path.GetDirectoryName(packageReferenceA.NupkgPath), Path.GetDirectoryName(packageReferenceB.NupkgPath) };
NuGetConfigWriter.Write(testAsset.TestRoot, sources);

var buildCommand = new BuildCommand(testAsset)
Expand Down Expand Up @@ -122,7 +122,7 @@ public void CanBuildProjectWithAPackageReferenceWithMultipleAliases()
testProject.SourceFiles[$"{testProject.Name}.cs"] = ClassLibAandBUsage;
var testAsset = _testAssetsManager.CreateTestProject(testProject);

List<string> sources = new() { NuGetConfigWriter.DotnetCoreBlobFeed, Path.GetDirectoryName(packageReferenceA.NupkgPath) };
List<string> sources = new() { Path.GetDirectoryName(packageReferenceA.NupkgPath) };
NuGetConfigWriter.Write(testAsset.TestRoot, sources);

var buildCommand = new BuildCommand(testAsset)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void It_targets_the_right_shared_framework(string targetFramework, string
}

// Test behavior when implicit version differs for framework-dependent and self-contained apps
[Theory(Skip = "https://github.com/dotnet/sdk/issues/45417")]
[Theory]
[InlineData("netcoreapp1.0", false, true, "1.0.5")]
[InlineData("netcoreapp1.0", true, true, "1.0.16")]
[InlineData("netcoreapp1.0", false, false, "1.0.5")]
Expand Down Expand Up @@ -133,7 +133,7 @@ private void It_targets_the_right_framework(

var testAsset = _testAssetsManager.CreateTestProject(testProject, testIdentifier);

NuGetConfigWriter.Write(testAsset.TestRoot, NuGetConfigWriter.DotnetCoreBlobFeed);
NuGetConfigWriter.Write(testAsset.TestRoot);

var buildCommand = new BuildCommand(testAsset);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private CommandResult GenerateDepsAndRunTool(TestProject toolProject, [CallerMem

var toolProjectInstance = _testAssetsManager.CreateTestProject(toolProject, callingMethod, identifier: toolProject.Name);

NuGetConfigWriter.Write(toolProjectInstance.TestRoot, NuGetConfigWriter.DotnetCoreBlobFeed);
NuGetConfigWriter.Write(toolProjectInstance.TestRoot);

// Workaround https://github.com/dotnet/cli/issues/9701
var useBundledNETCoreAppPackage = "/p:UseBundledNETCoreAppPackageVersionAsDefaultNetCorePatchVersion=true";
Expand Down Expand Up @@ -118,7 +118,7 @@ private CommandResult GenerateDepsAndRunTool(TestProject toolProject, [CallerMem
new XAttribute("Version", "1.0.0")));
});

List<string> sources = new() { NuGetConfigWriter.DotnetCoreBlobFeed };
List<string> sources = new();
sources.Add(nupkgPath);

NuGetConfigWriter.Write(toolReferencerInstance.TestRoot, sources);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,37 +121,6 @@ public void compose_dependencies_noopt()
storeDirectory.Should().OnlyHaveFiles(files_on_disk);
}

[Fact(Skip = "https://github.com/dotnet/sdk/issues/45417")]
public void store_nativeonlyassets()
{
TestAsset simpleDependenciesAsset = _testAssetsManager
.CopyTestAsset("UnmanagedStore")
.WithSource();

var storeCommand = new ComposeStoreCommand(Log, simpleDependenciesAsset.TestRoot);

var OutputFolder = Path.Combine(simpleDependenciesAsset.TestRoot, "outdir");
var WorkingDir = Path.Combine(simpleDependenciesAsset.TestRoot, "w");

NuGetConfigWriter.Write(simpleDependenciesAsset.TestRoot, NuGetConfigWriter.DotnetCoreBlobFeed);

storeCommand
.Execute($"/p:RuntimeIdentifier={_runtimeRid}", $"/p:TargetFramework={_tfm}", $"/p:ComposeWorkingDir={WorkingDir}", $"/p:ComposeDir={OutputFolder}", $"/p:DoNotDecorateComposeDir=true")
.Should()
.Pass();

DirectoryInfo storeDirectory = new(OutputFolder);

List<string> files_on_disk = new()
{
"artifact.xml",
$"runtime.{_runtimeRid}.microsoft.netcore.coredistools/1.0.1-prerelease-00001/runtimes/{_runtimeRid}/native/{_libPrefix}coredistools{FileConstants.DynamicLibSuffix}",
$"runtime.{_runtimeRid}.microsoft.netcore.coredistools/1.0.1-prerelease-00001/runtimes/{_runtimeRid}/native/coredistools.h"
};

storeDirectory.Should().OnlyHaveFiles(files_on_disk);
}

[Fact]
public void compose_multifile()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void It_issues_warning_and_skips_restore_for_obsolete_DotNetCliToolRefere
new XAttribute("Include", obsoletePackageId)));
});

NuGetConfigWriter.Write(toolProjectInstance.TestRoot, NuGetConfigWriter.DotnetCoreBlobFeed);
NuGetConfigWriter.Write(toolProjectInstance.TestRoot);

RestoreCommand restoreCommand = toolProjectInstance.GetRestoreCommand(Log, toolProject.Name);
restoreCommand.Execute("/v:n").Should()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void It_can_restore_with_netcoreapp2_2()

DeleteFolder(Path.Combine(TestContext.Current.NuGetCachePath, toolProject.Name.ToLowerInvariant()));
DeleteFolder(Path.Combine(TestContext.Current.NuGetCachePath, ".tools", toolProject.Name.ToLowerInvariant()));
NuGetConfigWriter.Write(toolReferenceProjectInstance.TestRoot, NuGetConfigWriter.DotnetCoreBlobFeed, nupkgPath);
NuGetConfigWriter.Write(toolReferenceProjectInstance.TestRoot, nupkgPath);

RestoreCommand restoreCommand =
toolReferenceProjectInstance.GetRestoreCommand(log: Log, relativePath: toolReferenceProject.Name);
Expand Down
1 change: 0 additions & 1 deletion test/Microsoft.NET.TestFramework/NuGetConfigWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ namespace Microsoft.NET.TestFramework
{
public static class NuGetConfigWriter
{
public static readonly string DotnetCoreBlobFeed = "https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json";
public static readonly string AspNetCoreDevFeed = "https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json";

public static void Write(string folder, params string[] nugetSources)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,46 +1,25 @@
Warning: use of 'dotnet new --list' is deprecated. Use 'dotnet new list' instead.
For more information, run:
dotnet new list -h

These templates matched your input:

Template Name Short Name Language Tags
-------------------------------------------- -------------------------- ---------- ----------------------------------
API Controller apicontroller [C#] Web/ASP.NET
ASP.NET Core Empty web [C#],F# Web/Empty
ASP.NET Core gRPC Service grpc [C#] Web/gRPC/API/Service
ASP.NET Core Web API webapi [C#],F# Web/Web API/API/Service/WebAPI
ASP.NET Core Web API (native AOT) webapiaot [C#] Web/Web API/API/Service
ASP.NET Core Web App (Model-View-Controller) mvc [C#],F# Web/MVC
ASP.NET Core Web App (Razor Pages) webapp,razor [C#] Web/MVC/Razor Pages
Blazor Server App blazorserver [C#] Web/Blazor
Blazor Web App blazor [C#] Web/Blazor/WebAssembly
Blazor WebAssembly Standalone App blazorwasm [C#] Web/Blazor/WebAssembly/PWA
Class Library classlib [C#],F#,VB Common/Library
Console App console [C#],F#,VB Common/Console
dotnet gitignore file gitignore,.gitignore Config
Dotnet local tool manifest file tool-manifest Config
EditorConfig file editorconfig,.editorconfig Config
global.json file globaljson,global.json Config
MSBuild Directory.Build.props file buildprops MSBuild/props
MSBuild Directory.Build.targets file buildtargets MSBuild/props
MSBuild Directory.Packages.props file packagesprops MSBuild/packages/props/CPM
MSTest Playwright Test Project mstest-playwright [C#] Test/MSTest/Playwright/Desktop/Web
MSTest Test Class mstest-class [C#],F#,VB Test/MSTest
MSTest Test Project mstest [C#],F#,VB Test/MSTest/Desktop/Web
MVC Controller mvccontroller [C#] Web/ASP.NET
MVC ViewImports viewimports [C#] Web/ASP.NET
MVC ViewStart viewstart [C#] Web/ASP.NET
NuGet Config nugetconfig,nuget.config Config
NUnit 3 Test Item nunit-test [C#],F#,VB Test/NUnit
NUnit 3 Test Project nunit [C#],F#,VB Test/NUnit/Desktop/Web
NUnit Playwright Test Project nunit-playwright [C#] Test/NUnit/Playwright/Desktop/Web
Protocol Buffer File proto Web/gRPC
Razor Class Library razorclasslib [C#] Web/Razor/Library
Razor Component razorcomponent [C#] Web/ASP.NET
Razor Page page [C#] Web/ASP.NET
Razor View view [C#] Web/ASP.NET
Solution File sln,solution Solution
Web Config webconfig Config
Worker Service worker [C#],F# Common/Worker/Web
xUnit Test Project xunit [C#],F#,VB Test/xUnit/Desktop/Web
Template Name Short Name Language Tags
API
ASP.NET
Blazor
Class
Console
dotnet
Dotnet
EditorConfig
global.json
MSBuild
MSTest
MVC
NuGet
NUnit
Protocol
Razor
Solution
Web
Worker
xUnit
Original file line number Diff line number Diff line change
@@ -1,46 +1,25 @@
Warning: use of 'dotnet new --list' is deprecated. Use 'dotnet new list' instead.
For more information, run:
dotnet new list -h

These templates matched your input:

Template Name Short Name Language Tags
-------------------------------------------- -------------------------- ---------- ------------------------------
API Controller apicontroller [C#] Web/ASP.NET
ASP.NET Core Empty web [C#],F# Web/Empty
ASP.NET Core gRPC Service grpc [C#] Web/gRPC/API/Service
ASP.NET Core Web API webapi [C#],F# Web/Web API/API/Service/WebAPI
ASP.NET Core Web API (native AOT) webapiaot [C#] Web/Web API/API/Service
ASP.NET Core Web App (Model-View-Controller) mvc [C#],F# Web/MVC
ASP.NET Core Web App (Razor Pages) webapp,razor [C#] Web/MVC/Razor Pages
Blazor Server App blazorserver [C#] Web/Blazor
Blazor Web App blazor [C#] Web/Blazor/WebAssembly
Blazor WebAssembly Standalone App blazorwasm [C#] Web/Blazor/WebAssembly/PWA
Class Library classlib [C#],F#,VB Common/Library
Console App console [C#],F#,VB Common/Console
dotnet gitignore file gitignore,.gitignore Config
Dotnet local tool manifest file tool-manifest Config
EditorConfig file editorconfig,.editorconfig Config
global.json file globaljson,global.json Config
MSBuild Directory.Build.props file buildprops MSBuild/props
MSBuild Directory.Build.targets file buildtargets MSBuild/props
MSBuild Directory.Packages.props file packagesprops MSBuild/packages/props/CPM
MSTest Playwright Test Project mstest-playwright [C#] Test/MSTest/Playwright
MSTest Test Class mstest-class [C#],F#,VB Test/MSTest
MSTest Test Project mstest [C#],F#,VB Test/MSTest
MVC Controller mvccontroller [C#] Web/ASP.NET
MVC ViewImports viewimports [C#] Web/ASP.NET
MVC ViewStart viewstart [C#] Web/ASP.NET
NuGet Config nugetconfig,nuget.config Config
NUnit 3 Test Item nunit-test [C#],F#,VB Test/NUnit
NUnit 3 Test Project nunit [C#],F#,VB Test/NUnit
NUnit Playwright Test Project nunit-playwright [C#] Test/NUnit/Playwright
Protocol Buffer File proto Web/gRPC
Razor Class Library razorclasslib [C#] Web/Razor/Library
Razor Component razorcomponent [C#] Web/ASP.NET
Razor Page page [C#] Web/ASP.NET
Razor View view [C#] Web/ASP.NET
Solution File sln,solution Solution
Web Config webconfig Config
Worker Service worker [C#],F# Common/Worker/Web
xUnit Test Project xunit [C#],F#,VB Test/xUnit
Template Name Short Name Language Tags
API
ASP.NET
Blazor
Class
Console
dotnet
Dotnet
EditorConfig
global.json
MSBuild
MSTest
MVC
NuGet
NUnit
Protocol
Razor
Solution
Web
Worker
xUnit
Loading
Loading