public void TestCommand_TeamCityNOOP_Sources(NuGetVersion version) { TempFilesHolder.WithTempFile( sources => { File.WriteAllText(sources, @"<sources> <source source=""http://localhost:1025/nuget/"" username=""u-WXjhnQSiZ1Ks3j3vqF2w11lCzeXJgqfS"" password=""p-9tZNW3k2DQhiPm76V5iVi2F3R25DO1PJ"" /></sources>"); Environment.SetEnvironmentVariable("TEAMCITY_NUGET_FEEDS", sources); try { var exec = ProcessExecutor.ExecuteProcess(Files.NuGetRunnerExe, Files.GetNuGetExe(version), "TeamCity.NOOP") .Dump() .AssertExitedSuccessfully() .AssertNoErrorOutput() .AssertOutputContains("CredentialsSetter") .AssertOutputContains("NuGetTeamCityInfo") ; if (version < NuGetVersion.NuGet_2_0) { exec.AssertOutputContains("Feed authentication is only supported", "##teamcity"); } else { exec.AssertOutputContains("ENABLED:feed=http://localhost:1025/nuget/,user=u-WXjhnQSiZ1Ks3j3vqF2w11lCzeXJgqfS"); } } finally { Environment.SetEnvironmentVariable("TEAMCITY_NUGET_FEEDS", ""); } }); }
public void TestCommands_RunConcurrently(NuGetVersion version) { bool failed = false; new[] { 1, 2, 3, 4 } .Select( x => new Thread(() => { for (int i = 0; i < 3; i++) { var proc = ProcessExecutor.ExecuteProcess(Files.NuGetRunnerExe, Files.GetNuGetExe(version), "TeamCity.Ping", "-Sleep"); if (proc.ExitCode != 0 || !string.IsNullOrWhiteSpace(proc.Error)) { proc.Dump(); failed = true; } proc.AssertNoErrorOutput().AssertExitedSuccessfully(); } }) { Name = "Checker " + x, }) .ToList() .Select(x => { x.Start(); return(x); }) .ToList() .Select(x => { x.Join(); return(0); }) .ToList(); Assert.IsFalse(failed); }
private static string FetchLatestNuGetCommandline() { var version = GetLatestRtmVersion(); var temp = CreateTempPath(); ProcessExecutor.Result result = null; for (int i = 2; i > 0; i--) { result = ProcessExecutor.ExecuteProcess(NuGetExe_4_3, "install", "NuGet.commandline", "-Source", NuGetConstants.DefaultFeedUrl_v2, "-Source", NuGetConstants.NuGetDevFeed, "-Version", version, "-ExcludeVersion", "-OutputDirectory", temp, "-Verbosity", "detailed") .Dump().AssertNoErrorOutput(); if (result.ExitCode == 0) { break; } } Assert.NotNull(result, "Result is null"); result.AssertExitedSuccessfully(); string nugetPath = Path.Combine(temp, "NuGet.CommandLine/tools/NuGet.exe"); Assert.IsTrue(File.Exists(nugetPath), string.Format("File {0} does not exists", nugetPath)); return(nugetPath); }
public void TestCommand_TeamCityPing(NuGetVersion version) { ProcessExecutor.ExecuteProcess(Files.NuGetRunnerExe, Files.GetNuGetExe(version), "TeamCity.Ping") .Dump() .AssertExitedSuccessfully() .AssertNoErrorOutput() .AssertOutputContains("TeamCity NuGet Extension is available."); }
public void TestDumpExtensionsPath(NuGetVersion version) { var r = ProcessExecutor.ExecuteProcess(Files.NuGetRunnerExe, Files.GetNuGetExe(version), "---TeamCity.DumpExtensionsPath"); Console.Out.WriteLine(r); Assert.IsTrue(r.ExitCode == 0); }
public void TestExcuteNuGet(NuGetVersion version) { var r = ProcessExecutor.ExecuteProcess(Files.NuGetRunnerExe, Files.GetNuGetExe(version), "help"); Console.Out.WriteLine(r); Assert.IsTrue(r.ExitCode == 0); }
public void TestCommand_NuGetVersion(NuGetVersion version) { var res = ProcessExecutor.ExecuteProcess(Files.NuGetRunnerExe, Files.GetNuGetExe(version), "--TeamCity.NuGetVersion") .Dump() .AssertExitedSuccessfully() .AssertNoErrorOutput(); Assert.IsTrue(myExtensionsPattern.IsMatch(res.Output)); }
private static string FetchLatestNuGetCommandline() { var temp = CreateTempPath(); ProcessExecutor.ExecuteProcess(NuGetExe_1_8, "install", "NuGet.commandline", "-Source", NuGetConstants.NuGetFeed, "-ExcludeVersion", "-OutputDirectory", temp).Dump().AssertNoErrorOutput().AssertExitedSuccessfully(); string nugetPath = Path.Combine(temp, "NuGet.CommandLine/tools/NuGet.Exe"); Assert.IsTrue(File.Exists(nugetPath)); return(nugetPath); }
public void TestCommand_NuGetVersion(NuGetVersion version) { var res = ProcessExecutor.ExecuteProcess(Files.NuGetRunnerExe, Files.GetNuGetExe(version), "--TeamCity.NuGetVersion") .Dump() .AssertExitedSuccessfully() .AssertNoErrorOutput(); var text = res.Output; Assert.IsTrue(text.Contains("TeamCity.NuGetVersion: 1.") || text.Contains("TeamCity.NuGetVersion: 2.") || text.Contains("TeamCity.NuGetVersion: 3.")); }
public void TestExcuteNuGet_NuGetFromTemp(NuGetVersion version) { TempFilesHolder.WithTempDirectory( home => { var destNuGet = Path.Combine(home, "NuGet.exe"); File.Copy(Files.GetNuGetExe(version), destNuGet); ProcessExecutor.ExecuteProcess(Files.NuGetRunnerExe, destNuGet, "TeamCity.Ping") .Dump() .AssertExitedSuccessfully(); }); }
public void TestExcuteNuGet_BothInTemp(NuGetVersion version) { TempFilesHolder.WithTempDirectory( home => { var destNuGet = Path.Combine(home, "NuGet.exe"); var destRunner = Path.Combine(home, "TeamCity.NuGetRunner.exe"); File.Copy(Files.GetNuGetExe(version), destNuGet); File.Copy(Files.NuGetRunnerExe, destRunner); const string ext = "JetBrains.TeamCity.NuGet.ExtendedCommands.dll"; Directory.CreateDirectory(Path.Combine(home, "plugins4")); File.Copy(Path.Combine(Files.NuGetRunnerExe, "../plugins4/" + ext), Path.Combine(home, "plugins4/" + ext)); ProcessExecutor.ExecuteProcess(destRunner, destNuGet, "TeamCity.Ping") .Dump() .AssertExitedSuccessfully(); }); }
protected static XmlDocument DoTestWithSpec(NuGetVersion version, string spec) { return(TempFilesHolder.WithTempFile( fileOut => TempFilesHolder.WithTempFile( fileIn => { File.WriteAllText(fileIn, spec); ProcessExecutor.ExecuteProcess(Files.NuGetRunnerExe, Files.GetNuGetExe(version), "TeamCity.ListPackages", "-Request", fileIn, "-Response", fileOut) .Dump() .AssertExitedSuccessfully() ; Console.Out.WriteLine("Result: " + File.ReadAllText(fileOut)); var doc = new XmlDocument(); doc.Load(fileOut); return doc; }))); }