mirror of
https://github.com/lidarr/Lidarr
synced 2025-03-04 10:28:08 +00:00
Fixed: Bump 0.7.2, Allow update to 0.8+ netcore builds
This commit is contained in:
parent
47f4441c43
commit
38448333b2
5 changed files with 119 additions and 65 deletions
|
@ -7,7 +7,7 @@ variables:
|
|||
outputFolder: './_output'
|
||||
artifactsFolder: './_artifacts'
|
||||
testsFolder: './_tests'
|
||||
majorVersion: '0.7.1'
|
||||
majorVersion: '0.7.2'
|
||||
minorVersion: $[counter('minorVersion', 1076)]
|
||||
lidarrVersion: '$(majorVersion).$(minorVersion)'
|
||||
buildName: '$(Build.SourceBranchName).$(lidarrVersion)'
|
||||
|
@ -40,7 +40,7 @@ stages:
|
|||
imageName: 'ubuntu-16.04'
|
||||
Mac:
|
||||
osName: 'Mac'
|
||||
imageName: 'macos-10.13'
|
||||
imageName: 'macos-10.14'
|
||||
Windows:
|
||||
osName: 'Windows'
|
||||
imageName: 'vs2017-win2016'
|
||||
|
@ -78,7 +78,7 @@ stages:
|
|||
imageName: 'ubuntu-16.04'
|
||||
Mac:
|
||||
osName: 'Mac'
|
||||
imageName: 'macos-10.13'
|
||||
imageName: 'macos-10.14'
|
||||
Windows:
|
||||
osName: 'Windows'
|
||||
imageName: 'vs2017-win2016'
|
||||
|
@ -232,9 +232,6 @@ stages:
|
|||
displayName: Unit Native
|
||||
strategy:
|
||||
matrix:
|
||||
Mac:
|
||||
osName: 'Mac'
|
||||
imageName: 'macos-10.13'
|
||||
Windows:
|
||||
osName: 'Windows'
|
||||
imageName: 'vs2017-win2016'
|
||||
|
@ -282,33 +279,18 @@ stages:
|
|||
displayName: Unit Docker
|
||||
strategy:
|
||||
matrix:
|
||||
mono508:
|
||||
testName: 'Mono 5.8'
|
||||
containerImage: lidarr/testimages:mono-5.8
|
||||
mono510:
|
||||
testName: 'Mono 5.10'
|
||||
containerImage: lidarr/testimages:mono-5.10
|
||||
mono512:
|
||||
testName: 'Mono 5.12'
|
||||
containerImage: lidarr/testimages:mono-5.12
|
||||
mono514:
|
||||
testName: 'Mono 5.14'
|
||||
containerImage: lidarr/testimages:mono-5.14
|
||||
mono516:
|
||||
testName: 'Mono 5.16'
|
||||
containerImage: lidarr/testimages:mono-5.16
|
||||
mono518:
|
||||
testName: 'Mono 5.18'
|
||||
containerImage: lidarr/testimages:mono-5.18
|
||||
containerImage: servarr/testimages:mono-5.18
|
||||
mono520:
|
||||
testName: 'Mono 5.20'
|
||||
containerImage: lidarr/testimages:mono-5.20
|
||||
containerImage: servarr/testimages:mono-5.20
|
||||
mono600:
|
||||
testName: 'Mono 6.0'
|
||||
containerImage: lidarr/testimages:mono-6.0
|
||||
containerImage: servarr/testimages:mono-6.10
|
||||
mono604:
|
||||
testName: 'Mono 6.4'
|
||||
containerImage: lidarr/testimages:mono-6.4
|
||||
containerImage: servarr/testimages:mono-6.12
|
||||
|
||||
pool:
|
||||
vmImage: 'ubuntu-16.04'
|
||||
|
@ -350,10 +332,6 @@ stages:
|
|||
displayName: Integration Native
|
||||
strategy:
|
||||
matrix:
|
||||
Mac:
|
||||
osName: 'Mac'
|
||||
imageName: 'macos-10.13'
|
||||
pattern: 'Lidarr.**.osx.tar.gz'
|
||||
Windows:
|
||||
osName: 'Windows'
|
||||
imageName: 'vs2017-win2016'
|
||||
|
@ -412,33 +390,18 @@ stages:
|
|||
displayName: Integration Docker
|
||||
strategy:
|
||||
matrix:
|
||||
mono508:
|
||||
testName: 'Mono 5.8'
|
||||
containerImage: lidarr/testimages:mono-5.8
|
||||
mono510:
|
||||
testName: 'Mono 5.10'
|
||||
containerImage: lidarr/testimages:mono-5.10
|
||||
mono512:
|
||||
testName: 'Mono 5.12'
|
||||
containerImage: lidarr/testimages:mono-5.12
|
||||
mono514:
|
||||
testName: 'Mono 5.14'
|
||||
containerImage: lidarr/testimages:mono-5.14
|
||||
mono516:
|
||||
testName: 'Mono 5.16'
|
||||
containerImage: lidarr/testimages:mono-5.16
|
||||
mono518:
|
||||
testName: 'Mono 5.18'
|
||||
containerImage: lidarr/testimages:mono-5.18
|
||||
containerImage: servarr/testimages:mono-5.18
|
||||
mono520:
|
||||
testName: 'Mono 5.20'
|
||||
containerImage: lidarr/testimages:mono-5.20
|
||||
containerImage: servarr/testimages:mono-5.20
|
||||
mono600:
|
||||
testName: 'Mono 6.0'
|
||||
containerImage: lidarr/testimages:mono-6.0
|
||||
containerImage: servarr/testimages:mono-6.10
|
||||
mono604:
|
||||
testName: 'Mono 6.4'
|
||||
containerImage: lidarr/testimages:mono-6.4
|
||||
containerImage: servarr/testimages:mono-6.12
|
||||
|
||||
variables:
|
||||
pattern: 'Lidarr.**.linux.tar.gz'
|
||||
|
@ -506,7 +469,7 @@ stages:
|
|||
failBuild: true
|
||||
Mac:
|
||||
osName: 'Mac'
|
||||
imageName: 'macos-10.13' # Fails due to firefox not being installed on image
|
||||
imageName: 'macos-10.14' # Fails due to firefox not being installed on image
|
||||
pattern: 'Lidarr.**.osx.tar.gz'
|
||||
failBuild: false
|
||||
Windows:
|
||||
|
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using FluentAssertions;
|
||||
|
@ -21,15 +22,75 @@ namespace NzbDrone.Common.Test.Http
|
|||
{
|
||||
[IntegrationTest]
|
||||
[TestFixture(typeof(ManagedHttpDispatcher))]
|
||||
public class HttpClientFixture<TDispatcher> : TestBase<HttpClient> where TDispatcher : IHttpDispatcher
|
||||
public class HttpClientFixture<TDispatcher> : TestBase<HttpClient>
|
||||
where TDispatcher : IHttpDispatcher
|
||||
{
|
||||
private static string[] _httpBinHosts = new[] { "eu.httpbin.org", "httpbin.org" };
|
||||
private static int _httpBinRandom;
|
||||
private string[] _httpBinHosts;
|
||||
private int _httpBinSleep;
|
||||
private int _httpBinRandom;
|
||||
private string _httpBinHost;
|
||||
private string _httpBinHost2;
|
||||
|
||||
[OneTimeSetUp]
|
||||
public void FixtureSetUp()
|
||||
{
|
||||
// Always use our server for main tests
|
||||
var mainHost = "httpbin.servarr.com";
|
||||
|
||||
// Use mirrors for tests that use two hosts
|
||||
var candidates = new[] { "eu.httpbin.org", /* "httpbin.org", */ "www.httpbin.org" };
|
||||
|
||||
// httpbin.org is broken right now, occassionally redirecting to https if it's unavailable.
|
||||
_httpBinHost = mainHost;
|
||||
_httpBinHosts = candidates.Where(IsTestSiteAvailable).ToArray();
|
||||
|
||||
TestLogger.Info($"{candidates.Length} TestSites available.");
|
||||
|
||||
_httpBinSleep = _httpBinHosts.Length < 2 ? 100 : 10;
|
||||
}
|
||||
|
||||
private bool IsTestSiteAvailable(string site)
|
||||
{
|
||||
try
|
||||
{
|
||||
var req = WebRequest.Create($"https://{site}/get") as HttpWebRequest;
|
||||
var res = req.GetResponse() as HttpWebResponse;
|
||||
if (res.StatusCode != HttpStatusCode.OK)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
req = WebRequest.Create($"https://{site}/status/429") as HttpWebRequest;
|
||||
res = req.GetResponse() as HttpWebResponse;
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
res = ex.Response as HttpWebResponse;
|
||||
}
|
||||
|
||||
if (res == null || res.StatusCode != (HttpStatusCode)429)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
if (!_httpBinHosts.Any())
|
||||
{
|
||||
Assert.Inconclusive("No TestSites available");
|
||||
}
|
||||
|
||||
Mocker.GetMock<IPlatformInfo>().Setup(c => c.Version).Returns(new Version("1.0.0"));
|
||||
Mocker.GetMock<IOsInfo>().Setup(c => c.Name).Returns("TestOS");
|
||||
Mocker.GetMock<IOsInfo>().Setup(c => c.Version).Returns("9.0.0");
|
||||
|
@ -43,12 +104,18 @@ namespace NzbDrone.Common.Test.Http
|
|||
Mocker.SetConstant<IHttpDispatcher>(Mocker.Resolve<TDispatcher>());
|
||||
|
||||
// Used for manual testing of socks proxies.
|
||||
//Mocker.GetMock<IHttpProxySettingsProvider>()
|
||||
// .Setup(v => v.GetProxySettings(It.IsAny<HttpRequest>()))
|
||||
// .Returns(new HttpProxySettings(ProxyType.Socks5, "127.0.0.1", 5476, "", false));
|
||||
// Mocker.GetMock<IHttpProxySettingsProvider>()
|
||||
// .Setup(v => v.GetProxySettings(It.IsAny<HttpUri>()))
|
||||
// .Returns(new HttpProxySettings(ProxyType.Socks5, "127.0.0.1", 5476, "", false));
|
||||
|
||||
// Roundrobin over the two servers, to reduce the chance of hitting the ratelimiter.
|
||||
_httpBinHost = _httpBinHosts[_httpBinRandom++ % _httpBinHosts.Length];
|
||||
_httpBinHost2 = _httpBinHosts[_httpBinRandom++ % _httpBinHosts.Length];
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
Thread.Sleep(_httpBinSleep);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -245,7 +312,12 @@ namespace NzbDrone.Common.Test.Http
|
|||
|
||||
public void GivenOldCookie()
|
||||
{
|
||||
var oldRequest = new HttpRequest("https://eu.httpbin.org/get");
|
||||
if (_httpBinHost == _httpBinHost2)
|
||||
{
|
||||
Assert.Inconclusive("Need both httpbin.org and eu.httpbin.org to run this test.");
|
||||
}
|
||||
|
||||
var oldRequest = new HttpRequest($"https://{_httpBinHost2}/get");
|
||||
oldRequest.Cookies["my"] = "cookie";
|
||||
|
||||
var oldClient = new HttpClient(new IHttpRequestInterceptor[0], Mocker.Resolve<ICacheManager>(), Mocker.Resolve<IRateLimitService>(), Mocker.Resolve<IHttpDispatcher>(), Mocker.GetMock<IUserAgentBuilder>().Object, Mocker.Resolve<Logger>());
|
||||
|
@ -262,7 +334,7 @@ namespace NzbDrone.Common.Test.Http
|
|||
{
|
||||
GivenOldCookie();
|
||||
|
||||
var request = new HttpRequest("https://eu.httpbin.org/get");
|
||||
var request = new HttpRequest($"https://{_httpBinHost2}/get");
|
||||
|
||||
var response = Subject.Get<HttpBinResource>(request);
|
||||
|
||||
|
@ -278,7 +350,7 @@ namespace NzbDrone.Common.Test.Http
|
|||
{
|
||||
GivenOldCookie();
|
||||
|
||||
var request = new HttpRequest("https://httpbin.org/get");
|
||||
var request = new HttpRequest($"https://{_httpBinHost}/get");
|
||||
|
||||
var response = Subject.Get<HttpBinResource>(request);
|
||||
|
||||
|
|
|
@ -281,7 +281,7 @@ namespace NzbDrone.Common.Test
|
|||
[Test]
|
||||
public void GetUpdateClientExePath()
|
||||
{
|
||||
GetIAppDirectoryInfo().GetUpdateClientExePath().Should().BeEquivalentTo(@"C:\Temp\lidarr_update\Lidarr.Update.exe".AsOsAgnostic());
|
||||
GetIAppDirectoryInfo().GetUpdateClientExePath(new Version("0.7.1.1381")).Should().BeEquivalentTo(@"C:\Temp\lidarr_update\Lidarr.Update.exe".AsOsAgnostic());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace NzbDrone.Common.Extensions
|
|||
private const string DB_RESTORE = "lidarr.restore";
|
||||
private const string LOG_DB = "logs.db";
|
||||
private const string NLOG_CONFIG_FILE = "nlog.config";
|
||||
private const string UPDATE_CLIENT_EXE = "Lidarr.Update.exe";
|
||||
private const string UPDATE_CLIENT_EXE_NAME = "Lidarr.Update";
|
||||
|
||||
private static readonly string UPDATE_SANDBOX_FOLDER_NAME = "lidarr_update" + Path.DirectorySeparatorChar;
|
||||
private static readonly string UPDATE_PACKAGE_FOLDER_NAME = "Lidarr" + Path.DirectorySeparatorChar;
|
||||
|
@ -217,6 +217,19 @@ namespace NzbDrone.Common.Extensions
|
|||
return null;
|
||||
}
|
||||
|
||||
public static string ProcessNameToExe(this string processName, Version version)
|
||||
{
|
||||
// Windows always has exe (but is shunted to net core)
|
||||
// Linux is kept on mono pending manual upgrade to net core so has .exe
|
||||
// macOS is shunted to net core and does not have .exe
|
||||
if (OsInfo.IsWindows || OsInfo.IsLinux || (version.Major == 0 && version.Minor == 7))
|
||||
{
|
||||
processName += ".exe";
|
||||
}
|
||||
|
||||
return processName;
|
||||
}
|
||||
|
||||
public static string GetAppDataPath(this IAppFolderInfo appFolderInfo)
|
||||
{
|
||||
return appFolderInfo.AppDataFolder;
|
||||
|
@ -277,9 +290,9 @@ namespace NzbDrone.Common.Extensions
|
|||
return Path.Combine(GetUpdatePackageFolder(appFolderInfo), UPDATE_CLIENT_FOLDER_NAME);
|
||||
}
|
||||
|
||||
public static string GetUpdateClientExePath(this IAppFolderInfo appFolderInfo)
|
||||
public static string GetUpdateClientExePath(this IAppFolderInfo appFolderInfo, Version version)
|
||||
{
|
||||
return Path.Combine(GetUpdateSandboxFolder(appFolderInfo), UPDATE_CLIENT_EXE);
|
||||
return Path.Combine(GetUpdateSandboxFolder(appFolderInfo), UPDATE_CLIENT_EXE_NAME).ProcessNameToExe(version);
|
||||
}
|
||||
|
||||
public static string GetDatabase(this IAppFolderInfo appFolderInfo)
|
||||
|
|
|
@ -131,10 +131,16 @@ namespace NzbDrone.Core.Update
|
|||
_logger.Info("Preparing client");
|
||||
_diskTransferService.TransferFolder(_appFolderInfo.GetUpdateClientFolder(), updateSandboxFolder, TransferMode.Move, false);
|
||||
|
||||
_logger.Info("Starting update client {0}", _appFolderInfo.GetUpdateClientExePath());
|
||||
// Set executable flag on update app
|
||||
if (OsInfo.IsOsx)
|
||||
{
|
||||
_diskProvider.SetPermissions(_appFolderInfo.GetUpdateClientExePath(updatePackage.Version), "0755", null, null);
|
||||
}
|
||||
|
||||
_logger.Info("Starting update client {0}", _appFolderInfo.GetUpdateClientExePath(updatePackage.Version));
|
||||
_logger.ProgressInfo("Lidarr will restart shortly.");
|
||||
|
||||
_processProvider.Start(_appFolderInfo.GetUpdateClientExePath(), GetUpdaterArgs(updateSandboxFolder));
|
||||
_processProvider.Start(_appFolderInfo.GetUpdateClientExePath(updatePackage.Version), GetUpdaterArgs(updateSandboxFolder));
|
||||
}
|
||||
|
||||
private void EnsureValidBranch(UpdatePackage package)
|
||||
|
|
Loading…
Add table
Reference in a new issue