Skip to content

Commit

Permalink
Central feed fixes for tests (#478)
Browse files Browse the repository at this point in the history
* Add diagnostic info

* Add nuget list source

* Test nuget.config

* Undo some of previous commits

* Clear and add internal feed

* Add --configfile

* Create temp path in output folder

* Cleanup
  • Loading branch information
zijchen committed Aug 5, 2024
1 parent eadc806 commit bd6a69c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/Microsoft.Build.Sql.Tests/BuildTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public void VerifyBuildFailureWithUnresolvedReference()
public void VerifyBuildWithProjectReference()
{
// We will copy the ReferenceProj to a temp folder and then add it as project reference
string tempFolder = Path.Combine(Path.GetTempPath(), TestContext.CurrentContext.Test.Name);
string tempFolder = TestUtils.CreateTempDirectory();
TestUtils.CopyDirectoryRecursive(Path.Combine(this.CommonTestDataDirectory, "ReferenceProj"), tempFolder);

this.AddProjectReference(Path.Combine(tempFolder, "ReferenceProj.sqlproj"));
Expand Down
2 changes: 1 addition & 1 deletion test/Microsoft.Build.Sql.Tests/DotnetTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ protected int RunDotnetCommandOnProject(string dotnetCommand, out string stdOutp
ProcessStartInfo dotnetStartInfo = new ProcessStartInfo
{
FileName = TestUtils.GetDotnetPath(),
Arguments = $"{dotnetCommand} {DatabaseProjectName}.sqlproj {arguments}",
Arguments = $"{dotnetCommand} {DatabaseProjectName}.sqlproj {arguments} -v n",
WorkingDirectory = this.WorkingDirectory,
WindowStyle = ProcessWindowStyle.Hidden,
RedirectStandardOutput = true,
Expand Down
10 changes: 10 additions & 0 deletions test/Microsoft.Build.Sql.Tests/TestUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,15 @@ public static string EscapeTestName(string testName)
{
return testName.Replace("\"", "_");
}

/// <summary>
/// Creates and returns the path to a temporary directory in the current directory.
/// </summary>
public static string CreateTempDirectory()
{
string tempDir = Path.Combine(Directory.GetCurrentDirectory(), Path.GetRandomFileName());
Directory.CreateDirectory(tempDir);
return tempDir;
}
}
}

0 comments on commit bd6a69c

Please sign in to comment.