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

[release/8.0.1xx] NugetConfigWriter: Update CDN tests #47368

Merged
merged 1 commit into from
Mar 7, 2025
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 @@ -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 List<string>() { NuGetConfigWriter.DotnetCoreBlobFeed };
List<string> sources = new();
sources.AddRange(packagesPaths);
NuGetConfigWriter.Write(testAsset.TestRoot, sources);

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

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

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

List<string> sources = new List<string>() { NuGetConfigWriter.DotnetCoreBlobFeed, Path.GetDirectoryName(packageReferenceA.NupkgPath) };
List<string> sources = new List<string>() { 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 @@ -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 List<string>() { 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 @@ -119,36 +119,6 @@ public void compose_dependencies_noopt()
storeDirectory.Should().OnlyHaveFiles(files_on_disk);
}

[Fact]
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 DirectoryInfo(OutputFolder);

List<string> files_on_disk = new List<string> {
"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 src/Tests/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