Skip to content

Commit

Permalink
Fix tests now that package pruning is enabled by default
Browse files Browse the repository at this point in the history
  • Loading branch information
dsplaisted committed Jan 29, 2025
1 parent d4d0438 commit 10e515d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ public static FrameworkPackages[] GetFrameworkPackages(NuGetFramework framework,
{
var frameworkPackages = new List<FrameworkPackages>();

if (frameworkReferences.Length == 0)
{
frameworkReferences = [DefaultFrameworkKey];
}

foreach (var frameworkReference in frameworkReferences)
{
var frameworkKey = GetFrameworkKey(frameworkReference);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ public void CompileConflictsAreNotRemovedFromRuntimeDepsAssets()

testProject.PackageReferences.Add(new TestPackageReference("Microsoft.AspNetCore.Mvc.Razor", "2.1.0"));

// This test relies on a package that would be pruned. This doesn't seem to be a customer scenario, it looks like it was
// an easier way to test that files that were removed
testProject.AdditionalProperties["RestoreEnablePackagePruning"] = "false";

var testAsset = _testAssetsManager.CreateTestProject(testProject);

var buildCommand = new BuildCommand(testAsset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,6 @@ public void compose_dependencies()
"fluentassertions.json/4.12.0/lib/netstandard1.3/FluentAssertions.Json.dll"
};

if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
// https://github.com/dotnet/core-setup/issues/2716 - an unintended native shim is getting published to the runtime store
files_on_disk.Add($"runtime.{_runtimeRid}.runtime.native.system.security.cryptography/1.0.1/runtimes/{_runtimeRid}/native/System.Security.Cryptography.Native{FileConstants.DynamicLibSuffix}");
}

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

Expand Down Expand Up @@ -114,12 +108,6 @@ public void compose_dependencies_noopt()
"fluentassertions.json/4.12.0/lib/netstandard1.3/FluentAssertions.Json.dll"
};

if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
// https://github.com/dotnet/core-setup/issues/2716 - an unintended native shim is getting published to the runtime store
files_on_disk.Add($"runtime.{_runtimeRid}.runtime.native.system.security.cryptography/1.0.1/runtimes/{_runtimeRid}/native/System.Security.Cryptography.Native{FileConstants.DynamicLibSuffix}");
}

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

Expand Down Expand Up @@ -157,12 +145,6 @@ public void compose_multifile()
"fluentassertions.json/4.12.0/lib/netstandard1.3/FluentAssertions.Json.dll",
};

if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
// https://github.com/dotnet/core-setup/issues/2716 - an unintended native shim is getting published to the runtime store
files_on_disk.Add($"runtime.{_runtimeRid}.runtime.native.system.security.cryptography/1.0.1/runtimes/{_runtimeRid}/native/System.Security.Cryptography.Native{FileConstants.DynamicLibSuffix}");
}

storeDirectory.Should().OnlyHaveFiles(files_on_disk);

var knownpackage = new HashSet<PackageIdentity>
Expand Down
4 changes: 4 additions & 0 deletions test/dotnet-list-package.Tests/GivenDotnetListPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ public static void Main(string[] args)
};

testProject.PackageReferences.Add(new TestPackageReference("NewtonSoft.Json", "9.0.1"));

// Disable package pruning so that there are still transitive dependencies to test the command
testProject.AdditionalProperties["RestoreEnablePackagePruning"] = "false";

var testAsset = _testAssetsManager.CreateTestProject(testProject);
var projectDirectory = Path.Combine(testAsset.Path, testProject.Name);

Expand Down

0 comments on commit 10e515d

Please sign in to comment.