mirror of
https://github.com/Radarr/Radarr
synced 2024-12-27 02:09:59 +00:00
Revert "Cache integration test DB to avoid repeated migrations"
This reverts commit 456169b8d2
.
This commit is contained in:
parent
e2c0d83f20
commit
05e8de2b0a
2 changed files with 4 additions and 57 deletions
|
@ -1,20 +0,0 @@
|
|||
using System.IO;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace NzbDrone.Integration.Test
|
||||
{
|
||||
[SetUpFixture]
|
||||
public class IntegrationTestSetup
|
||||
{
|
||||
[OneTimeSetUp]
|
||||
[OneTimeTearDown]
|
||||
public void CleanUp()
|
||||
{
|
||||
var dir = Path.Combine(TestContext.CurrentContext.TestDirectory, "CachedAppData");
|
||||
if (Directory.Exists(dir))
|
||||
{
|
||||
Directory.Delete(dir, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,43 +27,13 @@ public NzbDroneRunner(Logger logger, int port = 7878)
|
|||
_restClient = new RestClient("http://localhost:7878/api/v3");
|
||||
}
|
||||
|
||||
private void CopyDirectory(string source, string target)
|
||||
{
|
||||
foreach (var dirPath in Directory.GetDirectories(source, "*", SearchOption.AllDirectories))
|
||||
{
|
||||
Directory.CreateDirectory(dirPath.Replace(source, target));
|
||||
}
|
||||
|
||||
foreach (var newPath in Directory.GetFiles(source, "*.*", SearchOption.AllDirectories))
|
||||
{
|
||||
File.Copy(newPath, newPath.Replace(source, target), true);
|
||||
}
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
AppData = Path.Combine(TestContext.CurrentContext.TestDirectory, "_intg_" + TestBase.GetUID());
|
||||
Directory.CreateDirectory(AppData);
|
||||
|
||||
if (!Directory.Exists(Path.Combine(TestContext.CurrentContext.TestDirectory, "CachedAppData")))
|
||||
{
|
||||
Directory.CreateDirectory(AppData);
|
||||
GenerateConfigFile();
|
||||
StartInternal();
|
||||
KillAll(false);
|
||||
GenerateConfigFile();
|
||||
|
||||
CopyDirectory(AppData, Path.Combine(TestContext.CurrentContext.TestDirectory, "CachedAppData"));
|
||||
}
|
||||
else
|
||||
{
|
||||
CopyDirectory(Path.Combine(TestContext.CurrentContext.TestDirectory, "CachedAppData"), AppData);
|
||||
GenerateConfigFile();
|
||||
}
|
||||
|
||||
StartInternal();
|
||||
}
|
||||
|
||||
private void StartInternal()
|
||||
{
|
||||
string consoleExe;
|
||||
if (OsInfo.IsWindows)
|
||||
{
|
||||
|
@ -115,7 +85,7 @@ private void StartInternal()
|
|||
}
|
||||
}
|
||||
|
||||
public void KillAll(bool delete = true)
|
||||
public void KillAll()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -132,10 +102,7 @@ public void KillAll(bool delete = true)
|
|||
// May happen if the process closes while being closed
|
||||
}
|
||||
|
||||
if (delete)
|
||||
{
|
||||
TestBase.DeleteTempFolder(AppData);
|
||||
}
|
||||
TestBase.DeleteTempFolder(AppData);
|
||||
}
|
||||
|
||||
private void Start(string outputRadarrConsoleExe)
|
||||
|
|
Loading…
Reference in a new issue