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

enable PathTooLongException test #3216

Merged
Merged
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 @@ -1855,8 +1855,6 @@ public async Task RestoreCommand_LockedLockFileWithOutOfDateProjectAsync()
}
}

#if IS_DESKTOP
// TODO: To work on coreclr we need to address https://github.com/NuGet/Home/issues/7588
[Fact]
public void RestoreCommand_PathTooLongException()
{
Expand All @@ -1866,9 +1864,9 @@ public void RestoreCommand_PathTooLongException()
new PackageSource(NuGetConstants.V3FeedUrl)
};

using(var packagesDir = TestDirectory.Create())
using(var projectDir = TestDirectory.Create())
using(var cacheContext = new SourceCacheContext())
using (var packagesDir = TestDirectory.Create())
using (var projectDir = TestDirectory.Create())
using (var cacheContext = new SourceCacheContext())
{
var configJson = JObject.Parse(@"
{
Expand All @@ -1884,7 +1882,18 @@ public void RestoreCommand_PathTooLongException()
var spec = JsonPackageSpecReader.GetPackageSpec(configJson.ToString(), "TestProject", specPath);

var logger = new TestLogger();
var request = new TestRestoreRequest(spec, sources, packagesDir + new string('_', 300), cacheContext, logger)
string longPath = packagesDir + new string('_', 300);
try
{
// This test is pointless if the machine has long paths enabled.
Path.GetFullPath(longPath);
return;
}
catch (PathTooLongException)
{
}

var request = new TestRestoreRequest(spec, sources, longPath, cacheContext, logger)
{
LockFilePath = Path.Combine(projectDir, "project.lock.json")
};
Expand All @@ -1895,7 +1904,6 @@ public void RestoreCommand_PathTooLongException()
new Func<Task>(async () => await command.ExecuteAsync()).ShouldThrow<PathTooLongException>();
}
}
#endif

[Fact]
public async Task RestoreCommand_RestoreExactVersionWithFailingSourceAsync()
Expand Down