curl-upgrade
Keivan Beigi 8 years ago
parent c13fff1358
commit 5abcf887b0
No known key found for this signature in database
GPG Key ID: C536675AC49003C0

@ -94,7 +94,7 @@
<Compile Include="LevenshteinDistanceFixture.cs" /> <Compile Include="LevenshteinDistanceFixture.cs" />
<Compile Include="OsPathFixture.cs" /> <Compile Include="OsPathFixture.cs" />
<Compile Include="PathExtensionFixture.cs" /> <Compile Include="PathExtensionFixture.cs" />
<Compile Include="ProcessProviderTests.cs" /> <Compile Include="Processes\ProcessProviderFixture.cs" />
<Compile Include="ReflectionExtensions.cs" /> <Compile Include="ReflectionExtensions.cs" />
<Compile Include="ReflectionTests\ReflectionExtensionFixture.cs" /> <Compile Include="ReflectionTests\ReflectionExtensionFixture.cs" />
<Compile Include="ServiceFactoryFixture.cs" /> <Compile Include="ServiceFactoryFixture.cs" />

@ -10,20 +10,20 @@ using NzbDrone.Common.Processes;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
using NzbDrone.Test.Dummy; using NzbDrone.Test.Dummy;
namespace NzbDrone.Common.Test namespace NzbDrone.Common.Test.Processes
{ {
[TestFixture] [TestFixture]
public class ProcessProviderTests : TestBase<ProcessProvider> public class ProcessProviderFixture : TestBase<ProcessProvider>
{ {
[SetUp] [SetUp]
public void Setup() public void Setup()
{ {
Process.GetProcessesByName(DummyApp.DUMMY_PROCCESS_NAME).ToList().ForEach(c => Process.GetProcessesByName(DummyApp.DUMMY_PROCCESS_NAME).ToList().ForEach(c =>
{ {
c.Kill(); c.Kill();
c.WaitForExit(); c.WaitForExit();
}); });
Process.GetProcessesByName(DummyApp.DUMMY_PROCCESS_NAME).Should().BeEmpty(); Process.GetProcessesByName(DummyApp.DUMMY_PROCCESS_NAME).Should().BeEmpty();
} }
@ -41,7 +41,7 @@ namespace NzbDrone.Common.Test
{ {
TestLogger.Warn(ex, "{0} when killing process", ex.Message); TestLogger.Warn(ex, "{0} when killing process", ex.Message);
} }
}); });
} }
@ -101,5 +101,11 @@ namespace NzbDrone.Common.Test
Console.WriteLine(new ProcessInfo().ToString()); Console.WriteLine(new ProcessInfo().ToString());
ExceptionVerification.MarkInconclusive(typeof(Win32Exception)); ExceptionVerification.MarkInconclusive(typeof(Win32Exception));
} }
[Test]
public void should_find_process_by_name()
{
Subject.FindProcessByName(Process.GetCurrentProcess().ProcessName).Should().NotBeNull();
}
} }
} }

@ -33,22 +33,21 @@ namespace NzbDrone.Common.Instrumentation.Sentry
public SentryTarget(string dsn) public SentryTarget(string dsn)
{ {
_debounce = new SentryDebounce();
_client = new RavenClient(new Dsn(dsn), new SonarrJsonPacketFactory(), new SentryRequestFactory(), new MachineNameUserFactory()) _client = new RavenClient(new Dsn(dsn), new SonarrJsonPacketFactory(), new SentryRequestFactory(), new MachineNameUserFactory())
{ {
Compression = true, Compression = true,
Environment = RuntimeInfo.IsProduction ? "production" : "development", Release = BuildInfo.Release,
Release = BuildInfo.Release ErrorOnCapture = OnError,
Timeout = TimeSpan.FromSeconds(1)
}; };
_client.ErrorOnCapture = OnError;
_client.Tags.Add("osfamily", OsInfo.Os.ToString()); _client.Tags.Add("osfamily", OsInfo.Os.ToString());
_client.Tags.Add("runtime", PlatformInfo.Platform.ToString().ToLower()); _client.Tags.Add("runtime", PlatformInfo.Platform.ToString().ToLower());
_client.Tags.Add("culture", Thread.CurrentThread.CurrentCulture.Name); _client.Tags.Add("culture", Thread.CurrentThread.CurrentCulture.Name);
_client.Tags.Add("branch", BuildInfo.Branch); _client.Tags.Add("branch", BuildInfo.Branch);
_client.Tags.Add("version", BuildInfo.Version.ToString()); _client.Tags.Add("version", BuildInfo.Version.ToString());
_debounce = new SentryDebounce();
} }
private void OnError(Exception ex) private void OnError(Exception ex)

@ -43,7 +43,7 @@ namespace NzbDrone.Core.Download.Clients.Hadouken
} }
catch (DownloadClientException ex) catch (DownloadClientException ex)
{ {
_logger.ErrorException(ex.Message, ex); _logger.Error(ex);
return Enumerable.Empty<DownloadClientItem>(); return Enumerable.Empty<DownloadClientItem>();
} }
@ -170,12 +170,12 @@ namespace NzbDrone.Core.Download.Clients.Hadouken
if (version < new Version("5.1")) if (version < new Version("5.1"))
{ {
return new ValidationFailure(string.Empty, "Old Hadouken client with unsupported API, need 5.1 or higher"); return new ValidationFailure(string.Empty, "Old Hadouken client with unsupported API, need 5.1 or higher");
} }
} }
catch (DownloadClientAuthenticationException ex) catch (DownloadClientAuthenticationException ex)
{ {
_logger.ErrorException(ex.Message, ex); _logger.Error(ex);
return new NzbDroneValidationFailure("Password", "Authentication failed"); return new NzbDroneValidationFailure("Password", "Authentication failed");
} }
@ -191,7 +191,7 @@ namespace NzbDrone.Core.Download.Clients.Hadouken
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.ErrorException(ex.Message, ex); _logger.Error(ex);
return new NzbDroneValidationFailure(String.Empty, "Failed to get the list of torrents: " + ex.Message); return new NzbDroneValidationFailure(String.Empty, "Failed to get the list of torrents: " + ex.Message);
} }

@ -125,11 +125,11 @@ namespace NzbDrone.Core.Parser
Logger.Debug("Unable to parse langauge from subtitle file: {0}", fileName); Logger.Debug("Unable to parse langauge from subtitle file: {0}", fileName);
} }
catch (Exception ex) catch (Exception e)
{ {
Logger.Debug("Failed parsing langauge from subtitle file: {0}", fileName); Logger.Debug(e, "Failed parsing langauge from subtitle file: {0}", fileName);
} }
return Language.Unknown; return Language.Unknown;
} }
} }

@ -57,7 +57,7 @@ namespace NzbDrone.Test.Common
Assert.Fail("Process has exited"); Assert.Fail("Process has exited");
} }
SetApiKey(); GetApiKey();
var request = new RestRequest("system/status"); var request = new RestRequest("system/status");
request.AddHeader("Authorization", ApiKey); request.AddHeader("Authorization", ApiKey);
@ -71,7 +71,7 @@ namespace NzbDrone.Test.Common
return; return;
} }
Console.WriteLine("Waiting for NzbDrone to start. Response Status : {0} [{1}] {2}", statusCall.ResponseStatus, statusCall.StatusDescription, statusCall.ErrorException); Console.WriteLine("Waiting for NzbDrone to start. Response Status : {0} [{1}]", statusCall.ResponseStatus, statusCall.StatusDescription);
Thread.Sleep(500); Thread.Sleep(500);
} }
@ -81,7 +81,7 @@ namespace NzbDrone.Test.Common
{ {
if (_nzbDroneProcess != null) if (_nzbDroneProcess != null)
{ {
_processProvider.Kill(_nzbDroneProcess.Id); _processProvider.Kill(_nzbDroneProcess.Id);
} }
_processProvider.KillAll(ProcessProvider.NZB_DRONE_CONSOLE_PROCESS_NAME); _processProvider.KillAll(ProcessProvider.NZB_DRONE_CONSOLE_PROCESS_NAME);
@ -105,22 +105,22 @@ namespace NzbDrone.Test.Common
} }
} }
private void SetApiKey() private void GetApiKey()
{ {
var configFile = Path.Combine(AppData, "config.xml"); var configFile = Path.Combine(AppData, "config.xml");
var attempts = 0; var attempts = 0;
while (ApiKey == null && attempts < 50) while (ApiKey == null && attempts < 30)
{ {
try try
{ {
if (File.Exists(configFile)) if (File.Exists(configFile))
{ {
var apiKeyElement = XDocument.Load(configFile) var apiKeyElement = XDocument.Load(configFile).XPathSelectElement("Config/ApiKey");
.XPathSelectElement("Config/ApiKey");
if (apiKeyElement != null) if (apiKeyElement != null)
{ {
ApiKey = apiKeyElement.Value; ApiKey = apiKeyElement.Value;
return;
} }
} }
} }
@ -132,6 +132,8 @@ namespace NzbDrone.Test.Common
attempts++; attempts++;
Thread.Sleep(1000); Thread.Sleep(1000);
} }
Assert.Fail("Couldn't get API key in time.");
} }
} }
} }

@ -72,7 +72,7 @@ namespace NzbDrone.Update
if (OsInfo.IsNotWindows) if (OsInfo.IsNotWindows)
{ {
switch (args.Count()) switch (args.Length)
{ {
case 1: case 1:
return startupContext; return startupContext;

Loading…
Cancel
Save