Attempt to fix timeout issue only occurring on ci

This commit is contained in:
Zach Borboa
2021-03-15 22:35:18 -04:00
parent f979b5ee87
commit 6d04c33645
2 changed files with 27 additions and 1 deletions
+1 -1
View File
@@ -1163,7 +1163,7 @@ class CurlTest extends \PHPUnit\Framework\TestCase
$test = new Test();
$test->curl->verbose();
$test->curl->setTimeout(10);
$test->server('timeout', 'GET', array(
$test->server('timeout_legacy', 'GET', array(
'seconds' => '5',
));
+26
View File
@@ -301,6 +301,32 @@ if ($test === 'http_basic_auth') {
}
}
echo '",' . "\n";
echo ' "elapsed_seconds": "' . $elapsed . '",' . "\n";
echo ' "server_port": "' . ((int)$_SERVER['SERVER_PORT']) . '",' . "\n";
echo ' "server_start": "' . $server_start . '",' . "\n";
echo ' "server_stop": "' . microtime(true) . '"' . "\n";
echo '}' . "\n";
exit;
} elseif ($test === 'timeout_legacy') {
// Use --no-buffer to view loading indicator (e.g.
// curl --header "X-DEBUG-TEST: timeout_legacy" --include --no-buffer 127.0.0.1:8000/?seconds=3).
header('Content-Type: application/json');
$unsafe_seconds = (int)$_GET['seconds'];
$start = microtime(true);
echo '{' . "\n";
echo ' "loading": "';
while (true) {
echo '.';
flush();
sleep(1);
$elapsed = microtime(true) - $start;
if ($elapsed >= $unsafe_seconds) {
break;
}
}
echo '",' . "\n";
echo ' "elapsed_seconds": "' . $elapsed . '",' . "\n";
echo ' "server_port": "' . ((int)$_SERVER['SERVER_PORT']) . '",' . "\n";