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