diff --git a/tests/swoole_pdo_pgsql/long_running_pgsql_test.phpt b/tests/swoole_pdo_pgsql/long_running_pgsql_test.phpt new file mode 100644 index 00000000000..67c0ddfa55b --- /dev/null +++ b/tests/swoole_pdo_pgsql/long_running_pgsql_test.phpt @@ -0,0 +1,46 @@ +--TEST-- +swoole_pdo_pgsql: long running pgsql test +--SKIPIF-- + +--FILE-- + SWOOLE_HOOK_PDO_PGSQL]); +run(function() { + $waitGroup = new WaitGroup(); + $channel = new Channel(1); + Coroutine::create(function() use ($waitGroup, $channel) { + $waitGroup->add(); + $pdo = pdo_pgsql_test_inc::create(); + $pdo->query("SELECT pg_sleep(5);"); + $waitGroup->done(); + echo 'DONE' . PHP_EOL; + }); + + Coroutine::create(function() use ($waitGroup, $channel) { + $waitGroup->add(); + $result = $channel->pop(2); + if (!$result) { + echo 'channel pop timeout' . PHP_EOL; + } + $waitGroup->done(); + }); + + var_dump(1); + Coroutine::sleep(1); + var_dump(2); + $waitGroup->wait(); +}); +?> +--EXPECTF-- +int(1) +int(2) +channel pop timeout +DONE