Fixing a test that fails due to a race condition, because the .dotnet folder might not have been created yet.
This commit is contained in:
parent
20f0dac6b2
commit
015af46c99
1 changed files with 8 additions and 6 deletions
|
@ -91,21 +91,23 @@ namespace Microsoft.DotNet.Tests
|
||||||
[Fact]
|
[Fact]
|
||||||
public void ItDoesNotCreateAFirstUseSentinelFileUnderTheDotDotNetFolderWhenInternalReportInstallSuccessIsInvoked()
|
public void ItDoesNotCreateAFirstUseSentinelFileUnderTheDotDotNetFolderWhenInternalReportInstallSuccessIsInvoked()
|
||||||
{
|
{
|
||||||
var newHome = Path.Combine(_testDirectory, "new_home");
|
var emptyHome = Path.Combine(_testDirectory, "empty_home");
|
||||||
var newHomeFolder = new DirectoryInfo(Path.Combine(newHome, ".dotnet"));
|
|
||||||
|
|
||||||
var command = new DotnetCommand()
|
var command = new DotnetCommand()
|
||||||
.WithWorkingDirectory(_testDirectory);
|
.WithWorkingDirectory(_testDirectory);
|
||||||
command.Environment["HOME"] = newHome;
|
command.Environment["HOME"] = emptyHome;
|
||||||
command.Environment["USERPROFILE"] = newHome;
|
command.Environment["USERPROFILE"] = emptyHome;
|
||||||
command.Environment["APPDATA"] = newHome;
|
command.Environment["APPDATA"] = emptyHome;
|
||||||
command.Environment["DOTNET_CLI_TEST_FALLBACKFOLDER"] = _nugetFallbackFolder.FullName;
|
command.Environment["DOTNET_CLI_TEST_FALLBACKFOLDER"] = _nugetFallbackFolder.FullName;
|
||||||
command.Environment["DOTNET_SKIP_FIRST_TIME_EXPERIENCE"] = "";
|
command.Environment["DOTNET_SKIP_FIRST_TIME_EXPERIENCE"] = "";
|
||||||
|
// Disable to prevent the creation of the .dotnet folder by optimizationdata.
|
||||||
|
command.Environment["DOTNET_DISABLE_MULTICOREJIT"] = "true";
|
||||||
command.Environment["SkipInvalidConfigurations"] = "true";
|
command.Environment["SkipInvalidConfigurations"] = "true";
|
||||||
|
|
||||||
command.ExecuteWithCapturedOutput("internal-reportinstallsuccess test").Should().Pass();
|
command.ExecuteWithCapturedOutput("internal-reportinstallsuccess test").Should().Pass();
|
||||||
|
|
||||||
newHomeFolder.Should().NotHaveFile($"{GetDotnetVersion()}.dotnetFirstUseSentinel");
|
var emptyHomeFolder = new DirectoryInfo(Path.Combine(emptyHome, ".dotnet"));
|
||||||
|
emptyHomeFolder.Should().NotExist();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue