Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit 015af46

Browse files
Livar Cunhalivarcocc
authored andcommitted
Fixing a test that fails due to a race condition, because the .dotnet folder might not have been created yet.
1 parent 20f0dac commit 015af46

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,23 @@ public void ItCreatesAFirstUseSentinelFileUnderTheDotDotNetFolder()
9191
[Fact]
9292
public void ItDoesNotCreateAFirstUseSentinelFileUnderTheDotDotNetFolderWhenInternalReportInstallSuccessIsInvoked()
9393
{
94-
var newHome = Path.Combine(_testDirectory, "new_home");
95-
var newHomeFolder = new DirectoryInfo(Path.Combine(newHome, ".dotnet"));
94+
var emptyHome = Path.Combine(_testDirectory, "empty_home");
9695

9796
var command = new DotnetCommand()
9897
.WithWorkingDirectory(_testDirectory);
99-
command.Environment["HOME"] = newHome;
100-
command.Environment["USERPROFILE"] = newHome;
101-
command.Environment["APPDATA"] = newHome;
98+
command.Environment["HOME"] = emptyHome;
99+
command.Environment["USERPROFILE"] = emptyHome;
100+
command.Environment["APPDATA"] = emptyHome;
102101
command.Environment["DOTNET_CLI_TEST_FALLBACKFOLDER"] = _nugetFallbackFolder.FullName;
103102
command.Environment["DOTNET_SKIP_FIRST_TIME_EXPERIENCE"] = "";
103+
// Disable to prevent the creation of the .dotnet folder by optimizationdata.
104+
command.Environment["DOTNET_DISABLE_MULTICOREJIT"] = "true";
104105
command.Environment["SkipInvalidConfigurations"] = "true";
105106

106107
command.ExecuteWithCapturedOutput("internal-reportinstallsuccess test").Should().Pass();
107108

108-
newHomeFolder.Should().NotHaveFile($"{GetDotnetVersion()}.dotnetFirstUseSentinel");
109+
var emptyHomeFolder = new DirectoryInfo(Path.Combine(emptyHome, ".dotnet"));
110+
emptyHomeFolder.Should().NotExist();
109111
}
110112

111113
[Fact]

0 commit comments

Comments
 (0)