Skip to content

Commit 299279c

Browse files
committed
Merge branch 'main' into v3
# Conflicts: # .github/workflows/tests.yml # layers/fpm-dev/Dockerfile # php-80/Dockerfile # php-81/Dockerfile # php-82/Dockerfile # php-83/Dockerfile # php-84/Dockerfile # src/opcache.ini # src/php-85.ini # src/php.ini
2 parents 50cad11 + ba22245 commit 299279c

File tree

7 files changed

+29
-2
lines changed

7 files changed

+29
-2
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- x86
2626
- arm
2727
steps:
28-
- uses: actions/checkout@v4
28+
- uses: actions/checkout@v6
2929

3030
- name: Get the version
3131
id: get_version

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Tests
22

33
on:
44
push:
5-
branches: [ 'main', 'v3' ]
5+
branches: [ 'main', '2.x', 'v3' ]
66
pull_request:
77
branches: [ '*' ]
88

tests/test_4_function_invocation.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ function post(string $url, array $params)
2727

2828
$body = ['Hello' => 'From Bref!'];
2929

30+
waitForPort('127.0.0.1', 8080);
31+
3032
try {
3133
$response = post('http://127.0.0.1:8080/2015-03-31/functions/function/invocations', $body);
3234
$response = json_decode($response, true, 512, JSON_THROW_ON_ERROR);

tests/test_5_fpm_invocation.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ function post(string $url, string $body)
2525

2626
$body = file_get_contents(__DIR__ . '/test_5_event.json');
2727

28+
waitForPort('127.0.0.1', 8080);
29+
2830
try {
2931
$response = post('http://127.0.0.1:8080/2015-03-31/functions/function/invocations', $body);
3032
$response = json_decode($response, true, 512, JSON_THROW_ON_ERROR);

tests/test_6_console_invocation.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ function post(string $url, string $param)
2727

2828
$body = '"From Bref"';
2929

30+
waitForPort('127.0.0.1', 8080);
31+
3032
try {
3133
$response = post('http://127.0.0.1:8080/2015-03-31/functions/function/invocations', $body);
3234
$response = json_decode($response, true, 512, JSON_THROW_ON_ERROR);

tests/test_7_custom_ini_scan_dir.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ function post(string $url, string $params)
2727

2828
$body = 'list_extensions';
2929

30+
waitForPort('127.0.0.1', 8080);
31+
3032
try {
3133
$response = post('http://127.0.0.1:8080/2015-03-31/functions/function/invocations', $body);
3234
$response = json_decode($response, true, 512, JSON_THROW_ON_ERROR);

tests/utils.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,22 @@ function success(string $message): void
2525
}
2626
exit(1);
2727
}
28+
29+
/**
30+
* Wait for a port to be available (useful for QEMU-emulated containers that start slowly).
31+
*/
32+
function waitForPort(string $host, int $port, int $timeoutSeconds = 5): void
33+
{
34+
$start = time();
35+
while (true) {
36+
$socket = @fsockopen($host, $port, $errno, $errstr, 1);
37+
if ($socket !== false) {
38+
fclose($socket);
39+
return;
40+
}
41+
if (time() - $start >= $timeoutSeconds) {
42+
error("Timeout waiting for $host:$port to be available");
43+
}
44+
usleep(100000); // 100ms
45+
}
46+
}

0 commit comments

Comments
 (0)