Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ jobs:
dependencies: "highest"
symfony-version: "stable"
proxy: "lazy-ghost"
# Test with a 8.0 replica set
- topology: "replica_set"
php-version: "8.2"
mongodb-version: "8.0"
driver-version: "stable"
dependencies: "highest"
symfony-version: "stable"
proxy: "lazy-ghost"
# Test with ProxyManager
- php-version: "8.2"
mongodb-version: "6.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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);

Comment on lines +62 to +68
Copy link
Member Author

Choose a reason for hiding this comment

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

Fix this error:

1) Doctrine\ODM\MongoDB\Tests\Functional\ReadPreferenceTest::testHintIsSetOnQuery with data set #1 ('secondaryPreferred', [])
Failed asserting that null is an instance of class Documents\User.

/home/runner/work/mongodb-odm/mongodb-odm/tests/Doctrine/ODM/MongoDB/Tests/Functional/ReadPreferenceTest.php:61

2) Doctrine\ODM\MongoDB\Tests\Functional\ReadPreferenceTest::testHintIsSetOnQuery with data set #2 ('secondary', [['east'], []])
Failed asserting that null is an instance of class Documents\User.

self::assertInstanceOf(User::class, $user);

$groups = $user->getGroups();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testCreateTimeSeriesDocumentWithoutId(): void
$document->metadata = 'energy';

$this->dm->persist($document);
$this->dm->flush();
$this->dm->flush(['withTransaction' => false]);
Copy link
Member Author

Choose a reason for hiding this comment

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

Fix this error:

1) Doctrine\ODM\MongoDB\Tests\Functional\TimeSeriesTest::testCreateTimeSeriesDocumentWithoutId
MongoDB\Driver\Exception\BulkWriteException: time-series insert failed: doctrine_odm_tests.TimeSeriesDocument :: caused by :: Cannot insert into a time-series collection in a multi-document transaction: doctrine_odm_tests.TimeSeriesDocument

/home/runner/work/mongodb-odm/mongodb-odm/vendor/mongodb/mongodb/src/Operation/InsertMany.php:134
/home/runner/work/mongodb-odm/mongodb-odm/vendor/mongodb/mongodb/src/Collection.php:854
/home/runner/work/mongodb-odm/mongodb-odm/lib/Doctrine/ODM/MongoDB/Persisters/DocumentPersister.php:230
/home/runner/work/mongodb-odm/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php:1186
/home/runner/work/mongodb-odm/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php:3120
/home/runner/work/mongodb-odm/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php:467
/home/runner/work/mongodb-odm/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php:3172
/home/runner/work/mongodb-odm/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php:464
/home/runner/work/mongodb-odm/mongodb-odm/lib/Doctrine/ODM/MongoDB/DocumentManager.php:585
/home/runner/work/mongodb-odm/mongodb-odm/tests/Doctrine/ODM/MongoDB/Tests/Functional/TimeSeriesTest.php:44


$this->assertCount(1, $this->dm->getDocumentCollection(TimeSeriesDocument::class)->find());
}
Expand All @@ -57,7 +57,7 @@ public function testCreateTimeSeriesDocumentWithId(): void
$document->metadata = 'energy';

$this->dm->persist($document);
$this->dm->flush();
$this->dm->flush(['withTransaction' => false]);
Copy link
Member Author

Choose a reason for hiding this comment

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

Fix this error:

2) Doctrine\ODM\MongoDB\Tests\Functional\TimeSeriesTest::testCreateTimeSeriesDocumentWithId
MongoDB\Driver\Exception\BulkWriteException: time-series insert failed: doctrine_odm_tests.TimeSeriesDocument :: caused by :: Cannot insert into a time-series collection in a multi-document transaction: doctrine_odm_tests.TimeSeriesDocument

/home/runner/work/mongodb-odm/mongodb-odm/vendor/mongodb/mongodb/src/Operation/InsertMany.php:134
/home/runner/work/mongodb-odm/mongodb-odm/vendor/mongodb/mongodb/src/Collection.php:854
/home/runner/work/mongodb-odm/mongodb-odm/lib/Doctrine/ODM/MongoDB/Persisters/DocumentPersister.php:230
/home/runner/work/mongodb-odm/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php:1186
/home/runner/work/mongodb-odm/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php:3120
/home/runner/work/mongodb-odm/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php:467
/home/runner/work/mongodb-odm/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php:3172
/home/runner/work/mongodb-odm/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php:464
/home/runner/work/mongodb-odm/mongodb-odm/lib/Doctrine/ODM/MongoDB/DocumentManager.php:585
/home/runner/work/mongodb-odm/mongodb-odm/tests/Doctrine/ODM/MongoDB/Tests/Functional/TimeSeriesTest.php:60


$this->assertCount(1, $this->dm->getDocumentCollection(TimeSeriesDocument::class)->find());
}
Expand Down