Skip to content

Commit 66a655f

Browse files
committed
Add the actual test for FPM prod idle timeout test with 6s sleep
1 parent edfb347 commit 66a655f

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

sapi/fpm/tests/proc-idle-timeout.phpt

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
--TEST--
2+
FPM: Process manager config pm.process_idle_timeout
3+
--SKIPIF--
4+
<?php
5+
include "skipif.inc";
6+
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
7+
?>
8+
--FILE--
9+
<?php
10+
11+
require_once "tester.inc";
12+
13+
$cfg = <<<EOT
14+
[global]
15+
error_log = {{FILE:LOG}}
16+
[unconfined]
17+
listen = {{ADDR}}
18+
pm = ondemand
19+
pm.max_children = 3
20+
pm.process_idle_timeout = 1
21+
pm.status_path = /status
22+
EOT;
23+
24+
$code = <<<EOT
25+
<?php
26+
usleep(200);
27+
EOT;
28+
29+
$tester = new FPM\Tester($cfg, $code);
30+
$tester->start();
31+
$tester->expectLogStartNotices();
32+
$tester->multiRequest(2);
33+
$tester->status([
34+
'total processes' => 2,
35+
]);
36+
// wait for process idle timeout
37+
sleep(6);
38+
$tester->status([
39+
'total processes' => 1,
40+
]);
41+
$tester->terminate();
42+
$tester->expectLogTerminatingNotices();
43+
$tester->close();
44+
45+
?>
46+
Done
47+
--EXPECT--
48+
Done
49+
--CLEAN--
50+
<?php
51+
require_once "tester.inc";
52+
FPM\Tester::clean();
53+
?>

0 commit comments

Comments
 (0)