Fixed: Make ProcessProvider tests more reliable

pull/6/head
ta264 5 years ago
parent add0d22e56
commit 2049034883

@ -72,6 +72,8 @@ namespace NzbDrone.Common.Test
{ {
var process = StartDummyProcess(); var process = StartDummyProcess();
Thread.Sleep(500);
var check = Subject.GetProcessById(process.Id); var check = Subject.GetProcessById(process.Id);
check.Should().NotBeNull(); check.Should().NotBeNull();
@ -90,6 +92,8 @@ namespace NzbDrone.Common.Test
{ {
var process = StartDummyProcess(); var process = StartDummyProcess();
Thread.Sleep(500);
Subject.Exists(DummyApp.DUMMY_PROCCESS_NAME).Should() Subject.Exists(DummyApp.DUMMY_PROCCESS_NAME).Should()
.BeTrue("expected one dummy process to be already running"); .BeTrue("expected one dummy process to be already running");
@ -101,6 +105,7 @@ namespace NzbDrone.Common.Test
[Test] [Test]
[Retry(3)]
[Platform(Exclude="MacOsX")] [Platform(Exclude="MacOsX")]
[Retry(3)] [Retry(3)]
public void kill_all_should_kill_all_process_with_name() public void kill_all_should_kill_all_process_with_name()
@ -108,6 +113,8 @@ namespace NzbDrone.Common.Test
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();
@ -126,7 +133,7 @@ namespace NzbDrone.Common.Test
} }
}); });
if (!processStarted.Wait(2000)) if (!processStarted.Wait(5000))
{ {
Assert.Fail("Failed to start process within 2 sec"); Assert.Fail("Failed to start process within 2 sec");
} }

Loading…
Cancel
Save