Skip to content

Commit

Permalink
NugetConfigWriter: Remove DotnetCoreBlobFeed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edvilme committed Mar 7, 2025
1 parent 4773e29 commit 46e545d
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 39 deletions.
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 @@ -85,7 +85,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 @@ -122,7 +122,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

0 comments on commit 46e545d

Please sign in to comment.