8000 minor #30882 [Lock][TestSuite]Ensure the parent process is always kil… · sroze/symfony@0268b1d · GitHub
[go: up one dir, main page]

Skip to content

Commit 0268b1d

Browse files
committed
minor symfony#30882 [Lock][TestSuite]Ensure the parent process is always killed (greg0ire)
This PR was merged into the 4.2 branch. Discussion ---------- [Lock][TestSuite]Ensure the parent process is always killed | Q | A | ------------- | --- | Branch? | 4.2 | Bug fix? | yes, but for the test suite | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | n/a If you try to run the test suite but do not have a redis instance running, the parent process that was supposed to be killed will never be as the test is marked as skipped and the store never returned. This results in the test suite hanging forever at the end. In this patch, the exception is thrown again, and then caught in the trait, and the parent gets killed as it should. Commits ------- 94d4182 Ensure the parent process is always killed
2 parents 25db9e2 + 94d4182 commit 0268b1d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Symfony/Component/Lock/Tests/Store/BlockingStoreTestTrait.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ public function testBlockingLocks()
7474
// Block SIGHUP signal
7575
pcntl_sigprocmask(SIG_BLOCK, [SIGHUP]);
7676

77-
$store = $this->getStore();
7877
try {
78+
$store = $this->getStore();
7979
$store->save($key);
8080
// send the ready signal to the parent
8181
posix_kill($parentPID, SIGHUP);
@@ -87,7 +87,8 @@ public function testBlockingLocks()
8787
usleep($clockDelay);
8888
$store->delete($key);
8989
exit(0);
90-
} catch (\Exception $e) {
90+
} catch (\Throwable $e) {
91+
posix_kill($parentPID, SIGHUP);
9192
exit(1);
9293
}
9394
}

0 commit comments

Comments
 (0)
0