Skip to content

Commit 3b77228

Browse files
committed
kill process after test is over
1 parent b904a01 commit 3b77228

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

src/LocalGoTask.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ private function start()
5757
} catch (\Throwable $e){
5858
$returnChannel->push($e);
5959
}
60-
61-
6260
}
6361
}
6462
}

tests/Cases/CoroutineSocketTest.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,28 @@
3636
class CoroutineSocketTest extends AbstractTestCase
3737
{
3838
const UNIX_SOCKET = '/tmp/test.sock';
39-
4039
/**
41-
* @var RPC
40+
* @var Process
4241
*/
43-
private $task;
42+
private $p;
4443

4544
public function setUp()
4645
{
4746
! defined('BASE_PATH') && define('BASE_PATH', dirname(__DIR__, 1));
4847
@unlink(self::UNIX_SOCKET);
49-
$p = new Process(function (Process $process) {
50-
$process->exec(__DIR__ . '/../../app', ['-address', self::UNIX_SOCKET, '-standalone']);
48+
$this->p = new Process(function (Process $process) {
49+
$process->exec(__DIR__ . '/../../app', ['-address', self::UNIX_SOCKET]);
5150
});
52-
$p->start();
51+
$this->p->start();
5352
sleep(1);
5453
}
5554

55+
public function tearDown()
56+
{
57+
Process::kill($this->p->pid);
58+
}
59+
60+
5661
public function testOnCoroutine()
5762
{
5863
\Swoole\Coroutine\run(function () {

tests/Cases/IPCRelayTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ public function setUp()
2929
sleep(1);
3030
}
3131

32+
public function tearDown()
33+
{
34+
Process::kill($this->p->pid);
35+
}
36+
3237
public function testOnCoroutine()
3338
{
3439
\Swoole\Coroutine\run(function () {

0 commit comments

Comments
 (0)