cleanup
This commit is contained in:
parent
c13fff1358
commit
5abcf887b0
|
@ -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,10 +10,10 @@ 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]
|
||||||
|
@ -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>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ namespace NzbDrone.Core.Download.Clients.Hadouken
|
||||||
}
|
}
|
||||||
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,9 +125,9 @@ 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);
|
||||||
}
|
}
|
||||||
|
@ -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…
Reference in New Issue