Skip to content
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

PHPLIB-1531: Replace FailPointObserver with different logic #1427

Merged

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Sep 19, 2024

PHPLIB-1531

FailPointObserver relies on APM events exposing a server instance to record servers with enabled fail points. Since the method is deprecated, the context will now store all fail points created during the execution of a test, and the test runner will disable all fail points recorded in the context. This will achieve the same effect while allowing us to remove getServer from APM classes.

@alcaeus alcaeus force-pushed the phplib-1531-remove-getServer-failpoints branch from cfa6c2b to 63d8d4f Compare September 19, 2024 12:38
private function disableFailPoints(array $failPoints): void
{
foreach ($failPoints as ['failPoint' => $failPoint, 'server' => $server]) {
$operation = new DatabaseCommand('admin', ['configureFailPoint' => $failPoint, 'mode' => 'off']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$operation = new DatabaseCommand('admin', ['configureFailPoint' => $failPoint, 'mode' => 'off']);
$operation = new DatabaseCommand('admin', ['configureFailPoint' => $failPoint->configureFailPoint, 'mode' => 'off']);

@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

@alcaeus alcaeus marked this pull request as ready for review September 20, 2024 06:52
@alcaeus alcaeus requested a review from a team as a code owner September 20, 2024 06:52
@jmikola jmikola changed the title Replace FailPointObserver with different logic PHPLIB-1531: Replace FailPointObserver with different logic Sep 20, 2024
@jmikola jmikola merged commit 90dcf18 into mongodb:v1.20 Sep 20, 2024
36 checks passed
This was referenced Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants