Skip to content

Commit bc45571

Browse files
jmikolaGromNaN
authored andcommitted
Use dropCollection() helper to ensure collections are cleaned up
1 parent 408ad40 commit bc45571

7 files changed

+8
-5
lines changed

tests/SpecTests/Crud/Prose3_BulkWriteSplitsOnMaxWriteBatchSizeTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public function testSplitOnMaxWriteBatchSize(): void
2929
$maxWriteBatchSize = $this->getPrimaryServer()->getInfo()['maxWriteBatchSize'] ?? null;
3030
self::assertIsInt($maxWriteBatchSize);
3131

32+
$this->dropCollection($this->getDatabaseName(), $this->getCollectionName());
3233
$collection = $client->selectCollection($this->getDatabaseName(), $this->getCollectionName());
3334
$bulkWrite = ClientBulkWrite::createWithCollection($collection);
3435

tests/SpecTests/Crud/Prose4_BulkWriteSplitsOnMaxMessageSizeBytesTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function testSplitOnMaxWriteBatchSize(): void
3535
$numModels = (int) ($maxMessageSizeBytes / $maxBsonObjectSize + 1);
3636
$document = ['a' => str_repeat('b', $maxBsonObjectSize - 500)];
3737

38+
$this->dropCollection($this->getDatabaseName(), $this->getCollectionName());
3839
$collection = $client->selectCollection($this->getDatabaseName(), $this->getCollectionName());
3940
$bulkWrite = ClientBulkWrite::createWithCollection($collection);
4041

tests/SpecTests/Crud/Prose5_BulkWriteCollectsWriteConcernErrorsAcrossBatchesTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public function testCollectWriteConcernErrors(): void
4242
],
4343
]);
4444

45+
$this->dropCollection($this->getDatabaseName(), $this->getCollectionName());
4546
$collection = $client->selectCollection($this->getDatabaseName(), $this->getCollectionName());
4647
$bulkWrite = ClientBulkWrite::createWithCollection($collection);
4748

tests/SpecTests/Crud/Prose6_BulkWriteHandlesWriteErrorsAcrossBatchesTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public function testOrdered(): void
3535
$maxWriteBatchSize = $this->getPrimaryServer()->getInfo()['maxWriteBatchSize'] ?? null;
3636
self::assertIsInt($maxWriteBatchSize);
3737

38+
$this->dropCollection($this->getDatabaseName(), $this->getCollectionName());
3839
$collection = $client->selectCollection($this->getDatabaseName(), $this->getCollectionName());
39-
$collection->drop();
4040
$collection->insertOne(['_id' => 1]);
4141

4242
$bulkWrite = ClientBulkWrite::createWithCollection($collection, ['ordered' => true]);
@@ -64,8 +64,8 @@ public function testUnordered(): void
6464
$maxWriteBatchSize = $this->getPrimaryServer()->getInfo()['maxWriteBatchSize'] ?? null;
6565
self::assertIsInt($maxWriteBatchSize);
6666

67+
$this->dropCollection($this->getDatabaseName(), $this->getCollectionName());
6768
$collection = $client->selectCollection($this->getDatabaseName(), $this->getCollectionName());
68-
$collection->drop();
6969
$collection->insertOne(['_id' => 1]);
7070

7171
$bulkWrite = ClientBulkWrite::createWithCollection($collection, ['ordered' => false]);

tests/SpecTests/Crud/Prose7_BulkWriteHandlesCursorRequiringGetMoreTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public function testHandlesCursor(): void
3131
$maxBsonObjectSize = $this->getPrimaryServer()->getInfo()['maxBsonObjectSize'] ?? null;
3232
self::assertIsInt($maxBsonObjectSize);
3333

34+
$this->dropCollection($this->getDatabaseName(), $this->getCollectionName());
3435
$collection = $client->selectCollection($this->getDatabaseName(), $this->getCollectionName());
35-
$collection->drop();
3636

3737
$bulkWrite = ClientBulkWrite::createWithCollection($collection, ['verboseResults' => true]);
3838
$bulkWrite->updateOne(

tests/SpecTests/Crud/Prose8_BulkWriteHandlesCursorRequiringGetMoreWithinTransactionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public function testHandlesCursorWithinTransaction(): void
3232
$maxBsonObjectSize = $this->getPrimaryServer()->getInfo()['maxBsonObjectSize'] ?? null;
3333
self::assertIsInt($maxBsonObjectSize);
3434

35+
$this->dropCollection($this->getDatabaseName(), $this->getCollectionName());
3536
$collection = $client->selectCollection($this->getDatabaseName(), $this->getCollectionName());
36-
$collection->drop();
3737

3838
$bulkWrite = ClientBulkWrite::createWithCollection($collection, ['verboseResults' => true]);
3939
$bulkWrite->updateOne(

tests/SpecTests/Crud/Prose9_BulkWriteHandlesGetMoreErrorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public function testHandlesGetMoreError(): void
4343
],
4444
]);
4545

46+
$this->dropCollection($this->getDatabaseName(), $this->getCollectionName());
4647
$collection = $client->selectCollection($this->getDatabaseName(), $this->getCollectionName());
47-
$collection->drop();
4848

4949
$bulkWrite = ClientBulkWrite::createWithCollection($collection, ['verboseResults' => true]);
5050
$bulkWrite->updateOne(

0 commit comments

Comments
 (0)