Skip to content

Commit 0d90f8c

Browse files
committed
Try setting DOTNET_CLI_HOME in workload restore tests to avoid read-only FS errors
1 parent cab4f86 commit 0d90f8c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/dotnet.Tests/CommandTests/Workload/Restore/GivenDotnetWorkloadRestore.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ public GivenDotnetWorkloadRestore(ITestOutputHelper log) : base(log)
1515
[Fact]
1616
public void ProjectsThatDoNotSupportWorkloadsAreNotInspected()
1717
{
18+
var testDir = _testAssetsManager.CreateTestDirectory().Path;
19+
var cliHome = Path.Combine(testDir, ".home");
20+
1821
var projectPath =
1922
_testAssetsManager
2023
.CopyTestAsset(DcProjAssetName)
@@ -23,6 +26,7 @@ public void ProjectsThatDoNotSupportWorkloadsAreNotInspected()
2326

2427
new DotnetWorkloadCommand(Log, "restore")
2528
.WithWorkingDirectory(projectPath)
29+
.WithEnvironmentVariable("DOTNET_CLI_HOME", cliHome)
2630
.Execute()
2731
.Should()
2832
// if we did try to restore the dcproj in this TestAsset we would fail, so passing means we didn't!
@@ -32,6 +36,9 @@ public void ProjectsThatDoNotSupportWorkloadsAreNotInspected()
3236
[Fact]
3337
public void ProjectsThatDoNotSupportWorkloadsAndAreTransitivelyReferencedDoNotBreakTheBuild()
3438
{
39+
var testDir = _testAssetsManager.CreateTestDirectory().Path;
40+
var cliHome = Path.Combine(testDir, ".home");
41+
3542
var projectPath =
3643
_testAssetsManager
3744
.CopyTestAsset(TransitiveReferenceNoWorkloadsAssetName)
@@ -40,6 +47,7 @@ public void ProjectsThatDoNotSupportWorkloadsAndAreTransitivelyReferencedDoNotBr
4047

4148
new DotnetWorkloadCommand(Log, "restore")
4249
.WithWorkingDirectory(projectPath)
50+
.WithEnvironmentVariable("DOTNET_CLI_HOME", cliHome)
4351
.Execute()
4452
.Should()
4553
// if we did try to restore the esproj in this TestAsset we would fail, so passing means we didn't!

0 commit comments

Comments
 (0)