Skip to content

Commit

Permalink
PHPLIB-1240: Respect useMultipleMongoses:true for non-serverless LB t…
Browse files Browse the repository at this point in the history
…opologies
  • Loading branch information
jmikola committed Sep 15, 2023
1 parent 21781c9 commit f6f98e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions tests/SpecTests/RetryableWritesSpecTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ class RetryableWritesSpecTest extends FunctionalTestCase
*/
public function testRetryableWrites(stdClass $test, ?array $runOn, array $data): void
{
$useMultipleMongoses = isset($test->useMultipleMongoses) && $test->useMultipleMongoses && $this->isMongos();

if (isset($runOn)) {
$this->checkServerRequirements($runOn);
}

// Serverless uses a load balancer fronting a single proxy (PHPLIB-757)
$useMultipleMongoses = ($this->isMongos() || ($this->isLoadBalanced() && ! $this->isServerless()))

Check failure on line 42 in tests/SpecTests/RetryableWritesSpecTest.php

View workflow job for this annotation

GitHub Actions / phpcs

Useless parentheses.
? ($test->useMultipleMongoses ?? false)
: false;

$context = Context::fromRetryableWrites($test, $this->getDatabaseName(), $this->getCollectionName(), $useMultipleMongoses);
$this->setContext($context);

Expand Down
7 changes: 5 additions & 2 deletions tests/SpecTests/TransactionsSpecTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@ private function runTransactionTest(stdClass $test, ?array $runOn, array $data,
$this->markTestIncomplete(self::$incompleteTests[$this->dataDescription()]);
}

$useMultipleMongoses = isset($test->useMultipleMongoses) && $test->useMultipleMongoses && $this->isMongos();

if (isset($runOn)) {
$this->checkServerRequirements($runOn);
}
Expand All @@ -156,6 +154,11 @@ private function runTransactionTest(stdClass $test, ?array $runOn, array $data,
$databaseName ??= $this->getDatabaseName();
$collectionName ??= $this->getCollectionName();

// Serverless uses a load balancer fronting a single proxy (PHPLIB-757)
$useMultipleMongoses = ($this->isMongos() || ($this->isLoadBalanced() && ! $this->isServerless()))

Check failure on line 158 in tests/SpecTests/TransactionsSpecTest.php

View workflow job for this annotation

GitHub Actions / phpcs

Useless parentheses.
? ($test->useMultipleMongoses ?? false)
: false;

$context = Context::fromTransactions($test, $databaseName, $collectionName, $useMultipleMongoses);
$this->setContext($context);

Expand Down

0 comments on commit f6f98e7

Please sign in to comment.