mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 04:59:35 -07:00
Revert 7ffecf6
for ProcessProviderFixture
We already had some Lidarr specific changes that seemed more reliable
This commit is contained in:
parent
200473408a
commit
47f4441c43
1 changed files with 26 additions and 9 deletions
|
@ -16,7 +16,6 @@ namespace NzbDrone.Common.Test
|
||||||
// We don't want one tests setup killing processes used in another
|
// We don't want one tests setup killing processes used in another
|
||||||
[NonParallelizable]
|
[NonParallelizable]
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
[Platform(Exclude = "MacOsX")]
|
|
||||||
public class ProcessProviderFixture : TestBase<ProcessProvider>
|
public class ProcessProviderFixture : TestBase<ProcessProvider>
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -68,22 +67,25 @@ namespace NzbDrone.Common.Test
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
[Retry(3)]
|
||||||
public void should_be_able_to_start_process()
|
public void should_be_able_to_start_process()
|
||||||
{
|
{
|
||||||
var process = StartDummyProcess();
|
var process = StartDummyProcess();
|
||||||
|
|
||||||
Thread.Sleep(500);
|
var check = Subject.GetProcessById(process.Id);
|
||||||
|
check.Should().NotBeNull();
|
||||||
|
|
||||||
Subject.Exists(DummyApp.DUMMY_PROCCESS_NAME).Should()
|
process.Refresh();
|
||||||
.BeTrue("one running dummy process");
|
process.HasExited.Should().BeFalse();
|
||||||
|
|
||||||
process.Kill();
|
process.Kill();
|
||||||
process.WaitForExit();
|
process.WaitForExit();
|
||||||
|
process.HasExited.Should().BeTrue();
|
||||||
Subject.Exists(DummyApp.DUMMY_PROCCESS_NAME).Should().BeFalse();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
[Platform(Exclude="MacOsX")]
|
||||||
|
[Retry(3)]
|
||||||
public void exists_should_find_running_process()
|
public void exists_should_find_running_process()
|
||||||
{
|
{
|
||||||
var process = StartDummyProcess();
|
var process = StartDummyProcess();
|
||||||
|
@ -99,13 +101,13 @@ namespace NzbDrone.Common.Test
|
||||||
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
[Platform(Exclude="MacOsX")]
|
||||||
|
[Retry(3)]
|
||||||
public void kill_all_should_kill_all_process_with_name()
|
public void kill_all_should_kill_all_process_with_name()
|
||||||
{
|
{
|
||||||
var dummy1 = StartDummyProcess();
|
var dummy1 = StartDummyProcess();
|
||||||
var dummy2 = StartDummyProcess();
|
var dummy2 = StartDummyProcess();
|
||||||
|
|
||||||
Thread.Sleep(500);
|
|
||||||
|
|
||||||
Subject.KillAll(DummyApp.DUMMY_PROCCESS_NAME);
|
Subject.KillAll(DummyApp.DUMMY_PROCCESS_NAME);
|
||||||
|
|
||||||
dummy1.HasExited.Should().BeTrue();
|
dummy1.HasExited.Should().BeTrue();
|
||||||
|
@ -114,11 +116,26 @@ namespace NzbDrone.Common.Test
|
||||||
|
|
||||||
private Process StartDummyProcess()
|
private Process StartDummyProcess()
|
||||||
{
|
{
|
||||||
|
var processStarted = new ManualResetEventSlim();
|
||||||
|
|
||||||
var path = Path.Combine(TestContext.CurrentContext.TestDirectory, DummyApp.DUMMY_PROCCESS_NAME + ".exe");
|
var path = Path.Combine(TestContext.CurrentContext.TestDirectory, DummyApp.DUMMY_PROCCESS_NAME + ".exe");
|
||||||
return Subject.Start(path);
|
var process = Subject.Start(path, onOutputDataReceived: (string data) => {
|
||||||
|
if (data.StartsWith("Dummy process. ID:"))
|
||||||
|
{
|
||||||
|
processStarted.Set();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!processStarted.Wait(2000))
|
||||||
|
{
|
||||||
|
Assert.Fail("Failed to start process within 2 sec");
|
||||||
|
}
|
||||||
|
|
||||||
|
return process;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
[Retry(3)]
|
||||||
public void ToString_on_new_processInfo()
|
public void ToString_on_new_processInfo()
|
||||||
{
|
{
|
||||||
Console.WriteLine(new ProcessInfo().ToString());
|
Console.WriteLine(new ProcessInfo().ToString());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue