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

View file

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