-
Notifications
You must be signed in to change notification settings - Fork 266
PHPLIB-1531: Replace FailPointObserver with different logic #1427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -77,8 +77,6 @@ final class UnifiedTestRunner | |||||
/** @var callable(EntityMap):void */ | ||||||
private $entityMapObserver; | ||||||
|
||||||
private ?FailPointObserver $failPointObserver = null; | ||||||
|
||||||
private ServerParameterHelper $serverParameterHelper; | ||||||
|
||||||
public function __construct(string $internalClientUri) | ||||||
|
@@ -150,9 +148,6 @@ private function doSetUp(): void | |||||
* after transient error within a transaction" pinning test causes the | ||||||
* subsequent transaction test to block. */ | ||||||
$this->killAllSessions(); | ||||||
|
||||||
$this->failPointObserver = new FailPointObserver(); | ||||||
$this->failPointObserver->start(); | ||||||
} | ||||||
|
||||||
private function doTearDown(bool $hasFailed): void | ||||||
|
@@ -163,9 +158,6 @@ private function doTearDown(bool $hasFailed): void | |||||
$this->killAllSessions(); | ||||||
} | ||||||
|
||||||
$this->failPointObserver->stop(); | ||||||
$this->failPointObserver->disableFailPoints(); | ||||||
|
||||||
/* Manually invoking garbage collection since each test is prone to | ||||||
* create cycles (perhaps due to EntityMap), which can leak and prevent | ||||||
* sessions from being released back into the pool. */ | ||||||
|
@@ -216,13 +208,17 @@ private function doTestCase(stdClass $test, string $schemaVersion, ?array $runOn | |||||
$context->startEventObservers(); | ||||||
$context->startEventCollectors(); | ||||||
|
||||||
foreach ($test->operations as $o) { | ||||||
$operation = new Operation($o, $context); | ||||||
$operation->assert(); | ||||||
} | ||||||
try { | ||||||
foreach ($test->operations as $o) { | ||||||
$operation = new Operation($o, $context); | ||||||
$operation->assert(); | ||||||
} | ||||||
|
||||||
$context->stopEventObservers(); | ||||||
$context->stopEventCollectors(); | ||||||
$context->stopEventObservers(); | ||||||
$context->stopEventCollectors(); | ||||||
} finally { | ||||||
$this->disableFailPoints($context->getFailPoints()); | ||||||
} | ||||||
|
||||||
if (isset($test->expectEvents)) { | ||||||
assertIsArray($test->expectEvents); | ||||||
|
@@ -235,6 +231,15 @@ private function doTestCase(stdClass $test, string $schemaVersion, ?array $runOn | |||||
} | ||||||
} | ||||||
|
||||||
/** @param list<array{failPoint: stdClass, server: Server}> $failPoints */ | ||||||
private function disableFailPoints(array $failPoints): void | ||||||
{ | ||||||
foreach ($failPoints as ['failPoint' => $failPoint, 'server' => $server]) { | ||||||
$operation = new DatabaseCommand('admin', ['configureFailPoint' => $failPoint, 'mode' => 'off']); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
@alcaeus: This should resolve the runtime error you encountered. That said, I came up with another PR that consolidates this logic into a ManagesFailPointsTrait, which is closer to what we had with FailPointObserver. These files are already quite complex, so I wanted to minimize additional clutter. I'll defer to you, though. See: alcaeus#1 |
||||||
$operation->execute($server); | ||||||
} | ||||||
} | ||||||
|
||||||
/** | ||||||
* Checks server version and topology requirements. | ||||||
* | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.