diff --git a/.github/run-package-tests.sh b/.github/run-package-tests.sh
index 489ce26317c..e868e242d9e 100644
--- a/.github/run-package-tests.sh
+++ b/.github/run-package-tests.sh
@@ -156,6 +156,7 @@ export -f run_package_test_parallel
export STRICT
export PREFER_LOWEST
export FAILED_FILE
+export GRPC_ENABLE_FORK_SUPPORT=1
# Determine optimal parallelism: default to the number of CPU cores on the host runner
MAX_JOBS=${MAX_JOBS:-$(nproc 2>/dev/null || echo 8)}
diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml
index fa11eefebc6..3fa419126f4 100644
--- a/.github/workflows/unit-tests.yaml
+++ b/.github/workflows/unit-tests.yaml
@@ -7,6 +7,10 @@ on:
permissions:
contents: read
+
+env:
+ GRPC_ENABLE_FORK_SUPPORT: 1
+
jobs:
test:
strategy:
diff --git a/Auth/phpunit.xml.dist b/Auth/phpunit.xml.dist
index 2e225326917..127b65307ed 100644
--- a/Auth/phpunit.xml.dist
+++ b/Auth/phpunit.xml.dist
@@ -13,4 +13,7 @@
tests
+
+
+
diff --git a/Auth/tests/Cache/RaceConditionTest.php b/Auth/tests/Cache/RaceConditionTest.php
index 34d8b4249fe..63a7463c6ff 100644
--- a/Auth/tests/Cache/RaceConditionTest.php
+++ b/Auth/tests/Cache/RaceConditionTest.php
@@ -45,6 +45,11 @@ public function testRaceCondition(string $cacheClass)
if (!function_exists('pcntl_fork')) {
$this->markTestSkipped('pcntl_fork is not available');
}
+ if (extension_loaded('grpc') && !getenv('GRPC_ENABLE_FORK_SUPPORT')) {
+ $this->markTestSkipped(
+ 'Cannot run fork test with grpc extension unless GRPC_ENABLE_FORK_SUPPORT=1 is set.'
+ );
+ }
for ($i = 0; $i < 50; $i++) {
// SysV Cache warmup to prevent segment creation race
if ($cacheClass === SysVCacheItemPool::class) {
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index f94c12e3fbb..486f8590237 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -30,6 +30,7 @@
+