Skip to content

Commit

Permalink
Fix tests[4]
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Apr 23, 2024
1 parent 0a2671f commit c2b4472
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
8 changes: 8 additions & 0 deletions tests/include/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@
]);
}

if (IS_IN_CI) {
define('TEST_DOMAIN_1', 'www.google.com');
define('TEST_DOMAIN_2', 'www.yahoo.com');
} else {
define('TEST_DOMAIN_1', 'www.baidu.com');
define('TEST_DOMAIN_2', 'www.qq.com');
}

/** =============== IP ================ */
define('IP_REGEX', '/^(?:[\d]{1,3}\.){3}[\d]{1,3}$/');

Expand Down
4 changes: 2 additions & 2 deletions tests/swoole_runtime/stream_select/base.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ swoole_runtime/stream_select: base
require __DIR__ . '/../../include/bootstrap.php';
Swoole\Runtime::enableCoroutine();
go(function () {
$fp1 = stream_socket_client("tcp://www.baidu.com:80", $errno, $errstr, 30);
$fp2 = stream_socket_client("tcp://www.qq.com:80", $errno, $errstr, 30);
$fp1 = stream_socket_client("tcp://" . TEST_DOMAIN_1 . ":80", $errno, $errstr, 30);
$fp2 = stream_socket_client("tcp://" . TEST_DOMAIN_2 . ":80", $errno, $errstr, 30);
if (!$fp1) {
echo "$errstr ($errno)<br />\n";
} else {
Expand Down
6 changes: 3 additions & 3 deletions tests/swoole_runtime/stream_select/blocked.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ swoole_runtime/stream_select: blocked
<?php
require __DIR__ . '/../../include/bootstrap.php';
Swoole\Runtime::enableCoroutine(false);
$fp1 = stream_socket_client("tcp://www.baidu.com:80", $errno, $errstr, 30);
$fp2 = stream_socket_client("tcp://www.qq.com:80", $errno, $errstr, 30);
$fp1 = stream_socket_client("tcp://" . TEST_DOMAIN_1 . ":80", $errno, $errstr, 30);
$fp2 = stream_socket_client("tcp://" . TEST_DOMAIN_2 . ":80", $errno, $errstr, 30);
if (!$fp1) {
echo "$errstr ($errno)<br />\n";
} else {
fwrite($fp1, "GET / HTTP/1.0\r\nHost: www.baidu.com\r\nUser-Agent: curl/7.58.0\r\nAccept: */*\r\n\r\n");
fwrite($fp1, "GET / HTTP/1.0\r\nHost: " . TEST_DOMAIN_1 . "\r\nUser-Agent: curl/7.58.0\r\nAccept: */*\r\n\r\n");
$r_array = [$fp1, $fp2];
$w_array = $e_array = null;
$n = stream_select($r_array, $w_array, $e_array, 10);
Expand Down

0 comments on commit c2b4472

Please sign in to comment.