Fixed the failing windows tests by pointing to a NuGet.Config during restore. The issue there was that when NuGet finds a package in the fallback folder, it does not copy it to the packages folder when --packages is specified. Also, to avoid collateral changes during tests, set APPDATA env variable when running the first run experience tests.

This commit is contained in:
Livar Cunha 2017-04-03 10:45:35 -07:00
parent 347bd4b1fe
commit dee8725fd2
2 changed files with 6 additions and 2 deletions

View file

@ -60,6 +60,8 @@ namespace Microsoft.DotNet.New.Tests
string projectFolder, string projectFolder,
string packagesDirectory) string packagesDirectory)
{ {
var repoRootNuGetConfig = Path.Combine(RepoDirectoriesProvider.RepoRoot, "NuGet.Config");
new NewCommand() new NewCommand()
.WithWorkingDirectory(projectFolder) .WithWorkingDirectory(projectFolder)
.Execute($"{projectType} --debug:ephemeral-hive") .Execute($"{projectType} --debug:ephemeral-hive")
@ -67,7 +69,7 @@ namespace Microsoft.DotNet.New.Tests
new RestoreCommand() new RestoreCommand()
.WithWorkingDirectory(projectFolder) .WithWorkingDirectory(projectFolder)
.Execute($"--packages {packagesDirectory}") .Execute($"--configfile {repoRootNuGetConfig} --packages {packagesDirectory}")
.Should().Pass(); .Should().Pass();
} }
@ -88,6 +90,7 @@ namespace Microsoft.DotNet.New.Tests
var packagesDirectory = Path.Combine(rootPath, "packages"); var packagesDirectory = Path.Combine(rootPath, "packages");
var projectName = "Project"; var projectName = "Project";
var expectedVersion = GetFrameworkPackageVersion(); var expectedVersion = GetFrameworkPackageVersion();
var repoRootNuGetConfig = Path.Combine(RepoDirectoriesProvider.RepoRoot, "NuGet.Config");
new NewCommand() new NewCommand()
.WithWorkingDirectory(rootPath) .WithWorkingDirectory(rootPath)
@ -98,7 +101,7 @@ namespace Microsoft.DotNet.New.Tests
new RestoreCommand() new RestoreCommand()
.WithWorkingDirectory(rootPath) .WithWorkingDirectory(rootPath)
.Execute($"--packages {packagesDirectory}") .Execute($"--configfile {repoRootNuGetConfig} --packages {packagesDirectory}")
.Should().Pass(); .Should().Pass();
new DirectoryInfo(Path.Combine(packagesDirectory, packageName)) new DirectoryInfo(Path.Combine(packagesDirectory, packageName))

View file

@ -30,6 +30,7 @@ namespace Microsoft.DotNet.Tests
.WithWorkingDirectory(testDirectory); .WithWorkingDirectory(testDirectory);
command.Environment["HOME"] = testNuGetHome; command.Environment["HOME"] = testNuGetHome;
command.Environment["USERPROFILE"] = testNuGetHome; command.Environment["USERPROFILE"] = testNuGetHome;
command.Environment["APPDATA"] = testNuGetHome;
command.Environment["DOTNET_SKIP_FIRST_TIME_EXPERIENCE"] = ""; command.Environment["DOTNET_SKIP_FIRST_TIME_EXPERIENCE"] = "";
command.Environment["SkipInvalidConfigurations"] = "true"; command.Environment["SkipInvalidConfigurations"] = "true";