Skip to content

Commit 003e5eb

Browse files
committed
Use smaller maxAwaitTimeMS to speed up change stream tests
1 parent 2c87d39 commit 003e5eb

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/Operation/WatchFunctionalTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function testResume()
3333
{
3434
$this->insertDocument(['_id' => 1, 'x' => 'foo']);
3535

36-
$operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), []);
36+
$operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), [], ['maxAwaitTimeMS' => 100]);
3737
$changeStream = $operation->execute($this->getPrimaryServer());
3838

3939
$changeStream->rewind();
@@ -130,7 +130,7 @@ public function testNoChangeAfterResumeBeforeInsert()
130130
{
131131
$this->insertDocument(['_id' => 1, 'x' => 'foo']);
132132

133-
$operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), []);
133+
$operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), [], ['maxAwaitTimeMS' => 100]);
134134
$changeStream = $operation->execute($this->getPrimaryServer());
135135

136136
$changeStream->rewind();
@@ -172,7 +172,7 @@ public function testNoChangeAfterResumeBeforeInsert()
172172

173173
public function testResumeAfterKillThenNoOperations()
174174
{
175-
$operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), []);
175+
$operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), [], ['maxAwaitTimeMS' => 100]);
176176
$changeStream = $operation->execute($this->getPrimaryServer());
177177

178178
$this->killChangeStreamCursor($changeStream);
@@ -183,7 +183,7 @@ public function testResumeAfterKillThenNoOperations()
183183

184184
public function testResumeAfterKillThenOperation()
185185
{
186-
$operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), []);
186+
$operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), [], ['maxAwaitTimeMS' => 100]);
187187
$changeStream = $operation->execute($this->getPrimaryServer());
188188

189189
$this->killChangeStreamCursor($changeStream);
@@ -196,7 +196,7 @@ public function testResumeAfterKillThenOperation()
196196

197197
public function testKey()
198198
{
199-
$operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), []);
199+
$operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), [], ['maxAwaitTimeMS' => 100]);
200200
$changeStream = $operation->execute($this->getPrimaryServer());
201201

202202
$this->assertNull($changeStream->key());
@@ -226,7 +226,7 @@ public function testNonEmptyPipeline()
226226
{
227227
$pipeline = [['$project' => ['foo' => [0]]]];
228228

229-
$operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), $pipeline);
229+
$operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), $pipeline, ['maxAwaitTimeMS' => 100]);
230230
$changeStream = $operation->execute($this->getPrimaryServer());
231231

232232
$this->insertDocument(['_id' => 1]);
@@ -243,7 +243,7 @@ public function testNonEmptyPipeline()
243243

244244
public function testCursorWithEmptyBatchNotClosed()
245245
{
246-
$operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), []);
246+
$operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), [], ['maxAwaitTimeMS' => 100]);
247247
$changeStream = $operation->execute($this->getPrimaryServer());
248248

249249
$this->assertNotNull($changeStream);
@@ -256,7 +256,7 @@ public function testFailureAfterResumeTokenRemoved()
256256
{
257257
$pipeline = [['$project' => ['_id' => 0 ]]];
258258

259-
$operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), $pipeline);
259+
$operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), $pipeline, ['maxAwaitTimeMS' => 100]);
260260
$changeStream = $operation->execute($this->getPrimaryServer());
261261

262262
$this->insertDocument(['x' => 1]);

0 commit comments

Comments
 (0)