Fixed update client path issue

pull/7/merge
kay.one 13 years ago
parent 6369d4f817
commit fbf7d20c5d

@ -92,7 +92,7 @@
<Compile Include="JobTests\SearchJobTest.cs" /> <Compile Include="JobTests\SearchJobTest.cs" />
<Compile Include="ProviderTests\PostDownloadProviderTests\ProcessDownloadFixture.cs" /> <Compile Include="ProviderTests\PostDownloadProviderTests\ProcessDownloadFixture.cs" />
<Compile Include="ProviderTests\JobProviderTests\TestJobs.cs" /> <Compile Include="ProviderTests\JobProviderTests\TestJobs.cs" />
<Compile Include="ProviderTests\UpdateProviderTests\PreformUpdateFixture.cs" /> <Compile Include="ProviderTests\UpdateProviderTests\StartUpdateFixture.cs" />
<Compile Include="ProviderTests\UpdateProviderTests\GetAvilableUpdateFixture.cs" /> <Compile Include="ProviderTests\UpdateProviderTests\GetAvilableUpdateFixture.cs" />
<Compile Include="SortHelperTest.cs" /> <Compile Include="SortHelperTest.cs" />
<Compile Include="ProviderTests\EpisodeProviderTest_DeleteInvalidEpisodes.cs" /> <Compile Include="ProviderTests\EpisodeProviderTest_DeleteInvalidEpisodes.cs" />

@ -14,7 +14,7 @@ using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
{ {
[TestFixture] [TestFixture]
internal class PreformUpdateFixture : CoreTest internal class StartUpdateFixture : CoreTest
{ {
private const string SANDBOX_FOLDER = @"C:\Temp\nzbdrone_update\"; private const string SANDBOX_FOLDER = @"C:\Temp\nzbdrone_update\";
@ -41,7 +41,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
Mocker.GetMock<DiskProvider>().Setup(c => c.FolderExists(SANDBOX_FOLDER)).Returns(true); Mocker.GetMock<DiskProvider>().Setup(c => c.FolderExists(SANDBOX_FOLDER)).Returns(true);
//Act //Act
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage); Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
//Assert //Assert
Mocker.GetMock<DiskProvider>().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true)); Mocker.GetMock<DiskProvider>().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true));
@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
Mocker.GetMock<DiskProvider>().Setup(c => c.FolderExists(SANDBOX_FOLDER)).Returns(false); Mocker.GetMock<DiskProvider>().Setup(c => c.FolderExists(SANDBOX_FOLDER)).Returns(false);
//Act //Act
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage); Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
//Assert //Assert
Mocker.GetMock<DiskProvider>().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true), Times.Never()); Mocker.GetMock<DiskProvider>().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true), Times.Never());
@ -65,7 +65,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName); var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName);
//Act //Act
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage); Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
//Assert //Assert
Mocker.GetMock<HttpProvider>().Verify( Mocker.GetMock<HttpProvider>().Verify(
@ -78,7 +78,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName); var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName);
//Act //Act
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage); Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
//Assert //Assert
Mocker.GetMock<ArchiveProvider>().Verify( Mocker.GetMock<ArchiveProvider>().Verify(
@ -91,7 +91,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
var updateClientFolder = Mocker.GetMock<EnviromentProvider>().Object.GetUpdateClientFolder(); var updateClientFolder = Mocker.GetMock<EnviromentProvider>().Object.GetUpdateClientFolder();
//Act //Act
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage); Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
//Assert //Assert
Mocker.GetMock<DiskProvider>().Verify( Mocker.GetMock<DiskProvider>().Verify(
@ -108,13 +108,13 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
.SetupGet(c => c.NzbDroneProcessIdFromEnviroment).Returns(12); .SetupGet(c => c.NzbDroneProcessIdFromEnviroment).Returns(12);
//Act //Act
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage); Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
//Assert //Assert
Mocker.GetMock<ProcessProvider>().Verify( Mocker.GetMock<ProcessProvider>().Verify(
c => c.Start(It.Is<ProcessStartInfo>(p => c => c.Start(It.Is<ProcessStartInfo>(p =>
p.FileName == updateClientPath && p.FileName == updateClientPath &&
p.Arguments == "/12 /" + _clientGuid.ToString()) p.Arguments == "12 " + _clientGuid.ToString())
)); ));
} }
@ -134,7 +134,7 @@ namespace NzbDrone.Core.Test.ProviderTests.UpdateProviderTests
Mocker.Resolve<HttpProvider>(); Mocker.Resolve<HttpProvider>();
Mocker.Resolve<DiskProvider>(); Mocker.Resolve<DiskProvider>();
Mocker.Resolve<ArchiveProvider>(); Mocker.Resolve<ArchiveProvider>();
Mocker.Resolve<UpdateProvider>().StartUpgrade(updatePackage); Mocker.Resolve<UpdateProvider>().StartUpdate(updatePackage);
updateSubFolder.Refresh(); updateSubFolder.Refresh();
//Assert //Assert

@ -27,7 +27,7 @@ namespace NzbDrone.Core.Providers.Jobs
var updatePackage = _updateProvider.GetAvilableUpdate(); var updatePackage = _updateProvider.GetAvilableUpdate();
_updateProvider.StartUpgrade(updatePackage); _updateProvider.StartUpdate(updatePackage);
} }
} }
} }

@ -78,7 +78,7 @@ namespace NzbDrone.Core.Providers
return null; return null;
} }
public virtual void StartUpgrade(UpdatePackage updatePackage) public virtual void StartUpdate(UpdatePackage updatePackage)
{ {
var packageDestination = Path.Combine(_enviromentProvider.GetUpdateSandboxFolder(), updatePackage.FileName); var packageDestination = Path.Combine(_enviromentProvider.GetUpdateSandboxFolder(), updatePackage.FileName);
@ -104,7 +104,7 @@ namespace NzbDrone.Core.Providers
var startInfo = new ProcessStartInfo() var startInfo = new ProcessStartInfo()
{ {
FileName = _enviromentProvider.GetUpdateClientExePath(), FileName = _enviromentProvider.GetUpdateClientExePath(),
Arguments = string.Format("/{0} /{1}", _enviromentProvider.NzbDroneProcessIdFromEnviroment, _configFileProvider.Guid) Arguments = string.Format("{0} {1}", _enviromentProvider.NzbDroneProcessIdFromEnviroment, _configFileProvider.Guid)
}; };
_processProvider.Start(startInfo); _processProvider.Start(startInfo);

@ -64,7 +64,7 @@ namespace NzbDrone.Update.Test
_program.Start(new[] { "12", "" }); _program.Start(new[] { "12", "" });
//Assert //Assert
Mocker.GetMock<UpdateProvider>().Verify(c => c.Start(ProcessPath), Times.Once()); Mocker.GetMock<UpdateProvider>().Verify(c => c.Start(@"C:\NzbDrone"), Times.Once());
} }

@ -1,4 +1,5 @@
using System; using System;
using System.IO;
using System.Linq; using System.Linq;
using NLog; using NLog;
using NzbDrone.Common; using NzbDrone.Common;
@ -52,7 +53,8 @@ namespace NzbDrone.Update
VerfityArguments(args); VerfityArguments(args);
int processId = ParseProcessId(args); int processId = ParseProcessId(args);
string appPath = _processProvider.GetProcessById(processId).StartPath; FileInfo exeFileInfo = new FileInfo(_processProvider.GetProcessById(processId).StartPath);
string appPath = exeFileInfo.Directory.FullName;
logger.Info("Starting update process"); logger.Info("Starting update process");
_updateProvider.Start(appPath); _updateProvider.Start(appPath);

Loading…
Cancel
Save