proc-idle-timeout.phpt 957 B

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