-
-
Notifications
You must be signed in to change notification settings - Fork 515
Run tests with MongoDB 8.0 replica set #2798
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 all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,8 @@ | |
| use MongoDB\Driver\WriteConcern; | ||
| use PHPUnit\Framework\Attributes\DataProvider; | ||
|
|
||
| use function usleep; | ||
|
|
||
| /** @phpstan-type ReadPreferenceTagShape array{dc?: string, usage?: string} */ | ||
| class ReadPreferenceTest extends BaseTestCase | ||
| { | ||
|
|
@@ -57,7 +59,13 @@ public function testHintIsSetOnQuery(string $readPreference, array $tags = []): | |
|
|
||
| $this->assertReadPreferenceHint($readPreference, $query->getQuery()['readPreference'], $tags); | ||
|
|
||
| $user = $query->getSingleResult(); | ||
| $retries = 0; | ||
| do { | ||
| // Wait a bit to ensure replication has caught up. | ||
| usleep(1_000 * $retries); | ||
| $user = $query->getSingleResult(); | ||
| } while ($user === null && $retries++ < 100); | ||
GromNaN marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
Comment on lines
+62
to
+68
Member
Author
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. Fix this error: |
||
| self::assertInstanceOf(User::class, $user); | ||
|
|
||
| $groups = $user->getGroups(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,7 +41,7 @@ public function testCreateTimeSeriesDocumentWithoutId(): void | |
| $document->metadata = 'energy'; | ||
|
|
||
| $this->dm->persist($document); | ||
| $this->dm->flush(); | ||
| $this->dm->flush(['withTransaction' => false]); | ||
|
Member
Author
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. Fix this error: |
||
|
|
||
| $this->assertCount(1, $this->dm->getDocumentCollection(TimeSeriesDocument::class)->find()); | ||
| } | ||
|
|
@@ -57,7 +57,7 @@ public function testCreateTimeSeriesDocumentWithId(): void | |
| $document->metadata = 'energy'; | ||
|
|
||
| $this->dm->persist($document); | ||
| $this->dm->flush(); | ||
| $this->dm->flush(['withTransaction' => false]); | ||
|
Member
Author
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. Fix this error: |
||
|
|
||
| $this->assertCount(1, $this->dm->getDocumentCollection(TimeSeriesDocument::class)->find()); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.