|
18 | 18 | use MongoDB\Driver\Exception\ServerException;
|
19 | 19 | use MongoDB\Driver\Monitoring\CommandSucceededEvent;
|
20 | 20 | use MongoDB\Driver\ReadPreference;
|
| 21 | +use MongoDB\Driver\Server; |
21 | 22 | use MongoDB\Driver\WriteConcern;
|
22 | 23 | use MongoDB\Exception\ResumeTokenException;
|
23 | 24 | use MongoDB\Exception\UnsupportedValueException;
|
@@ -1371,7 +1372,7 @@ public function testOriginalReadPreferenceIsPreservedOnResume(): void
|
1371 | 1372 |
|
1372 | 1373 | $changeStream = $operation->execute($secondary);
|
1373 | 1374 | $previousCursorId = $changeStream->getCursorId();
|
1374 |
| - $this->forceChangeStreamResume(); |
| 1375 | + $this->forceChangeStreamResume($secondary); |
1375 | 1376 |
|
1376 | 1377 | $changeStream->next();
|
1377 | 1378 | $this->assertNotEquals($previousCursorId, $changeStream->getCursorId());
|
@@ -1611,17 +1612,20 @@ function (array $event) use (&$commands): void {
|
1611 | 1612 | $this->assertEmpty($commands);
|
1612 | 1613 | }
|
1613 | 1614 |
|
1614 |
| - private function forceChangeStreamResume(): void |
| 1615 | + private function forceChangeStreamResume(?Server $server = null): void |
1615 | 1616 | {
|
1616 |
| - $this->configureFailPoint([ |
1617 |
| - 'configureFailPoint' => 'failCommand', |
1618 |
| - 'mode' => ['times' => 1], |
1619 |
| - 'data' => [ |
1620 |
| - 'failCommands' => ['getMore'], |
1621 |
| - 'errorCode' => self::NOT_PRIMARY, |
1622 |
| - 'errorLabels' => ['ResumableChangeStreamError'], |
| 1617 | + $this->configureFailPoint( |
| 1618 | + [ |
| 1619 | + 'configureFailPoint' => 'failCommand', |
| 1620 | + 'mode' => ['times' => 1], |
| 1621 | + 'data' => [ |
| 1622 | + 'failCommands' => ['getMore'], |
| 1623 | + 'errorCode' => self::NOT_PRIMARY, |
| 1624 | + 'errorLabels' => ['ResumableChangeStreamError'], |
| 1625 | + ], |
1623 | 1626 | ],
|
1624 |
| - ]); |
| 1627 | + $server, |
| 1628 | + ); |
1625 | 1629 | }
|
1626 | 1630 |
|
1627 | 1631 | private function getPostBatchResumeTokenFromReply(stdClass $reply)
|
|
0 commit comments