Skip to content

Commit 9bdc229

Browse files
committed
Remove tests for pre-4.2 servers
1 parent 3f6d432 commit 9bdc229

File tree

8 files changed

+0
-97
lines changed

8 files changed

+0
-97
lines changed

tests/Collection/BuilderCollectionFunctionalTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,6 @@ public function testUpdateOne(): void
231231

232232
public function testUpdateWithPipeline(): void
233233
{
234-
$this->skipIfServerVersion('<', '4.2.0', 'Pipeline-style updates are not supported');
235-
236234
$result = $this->collection->updateOne(
237235
Query::query(x: Query::lt(2)),
238236
new Pipeline(
@@ -259,8 +257,6 @@ public function testUpdateMany(): void
259257

260258
public function testUpdateManyWithPipeline(): void
261259
{
262-
$this->skipIfServerVersion('<', '4.2.0', 'Pipeline-style updates are not supported');
263-
264260
$result = $this->collection->updateMany(
265261
Query::query(x: Query::gt(1)),
266262
new Pipeline(

tests/FunctionalTestCase.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -469,10 +469,6 @@ protected function skipIfCausalConsistencyIsNotSupported(): void
469469

470470
protected function skipIfClientSideEncryptionIsNotSupported(): void
471471
{
472-
if (version_compare($this->getFeatureCompatibilityVersion(), '4.2', '<')) {
473-
$this->markTestSkipped('Client Side Encryption only supported on FCV 4.2 or higher');
474-
}
475-
476472
if (static::getModuleInfo('libmongocrypt') === 'disabled') {
477473
$this->markTestSkipped('Client Side Encryption is not enabled in the MongoDB extension');
478474
}

tests/Operation/BulkWriteFunctionalTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,6 @@ function (array $event) use ($expectedReplacement): void {
198198
#[DataProvider('provideUpdatePipelines')]
199199
public function testUpdateDocuments($update, $expectedUpdate): void
200200
{
201-
if (is_array($expectedUpdate)) {
202-
$this->skipIfServerVersion('<', '4.2.0', 'Pipeline-style updates are not supported');
203-
}
204-
205201
(new CommandObserver())->observe(
206202
function () use ($update): void {
207203
$operation = new BulkWrite(
@@ -423,8 +419,6 @@ function (array $event): void {
423419

424420
public function testBulkWriteWithPipelineUpdates(): void
425421
{
426-
$this->skipIfServerVersion('<', '4.2.0', 'Pipeline-style updates are not supported');
427-
428422
$this->createFixtures(4);
429423

430424
$ops = [

tests/Operation/ExplainFunctionalTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,6 @@ public function testAggregate(): void
322322
#[DataProvider('provideVerbosityInformation')]
323323
public function testAggregateOptimizedToQuery($verbosity, $executionStatsExpected, $allPlansExecutionExpected): void
324324
{
325-
$this->skipIfServerVersion('<', '4.2.0', 'MongoDB < 4.2 does not optimize simple aggregation pipelines');
326-
327325
$this->createFixtures(3);
328326

329327
$pipeline = [['$match' => ['_id' => ['$ne' => 2]]]];

tests/Operation/FindAndModifyFunctionalTest.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -126,22 +126,6 @@ function (array $event): void {
126126
);
127127
}
128128

129-
public function testHintOptionUnsupportedClientSideError(): void
130-
{
131-
$this->skipIfServerVersion('>=', '4.2.0', 'server reports error for unsupported findAndModify options');
132-
133-
$operation = new FindAndModify(
134-
$this->getDatabaseName(),
135-
$this->getCollectionName(),
136-
['remove' => true, 'hint' => '_id_'],
137-
);
138-
139-
$this->expectException(UnsupportedException::class);
140-
$this->expectExceptionMessage('Hint is not supported by the server executing this operation');
141-
142-
$operation->execute($this->getPrimaryServer());
143-
}
144-
145129
public function testHintOptionAndUnacknowledgedWriteConcernUnsupportedClientSideError(): void
146130
{
147131
$this->skipIfServerVersion('>=', '4.4.0', 'hint is supported');

tests/Operation/UpdateFunctionalTest.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ function (array $event) use ($expectedFilter): void {
5454
#[DataProvider('provideReplacementDocumentLikePipeline')]
5555
public function testUpdateDocuments($update, $expectedUpdate): void
5656
{
57-
if (is_array($expectedUpdate)) {
58-
$this->skipIfServerVersion('<', '4.2.0', 'Pipeline-style updates are not supported');
59-
}
60-
6157
(new CommandObserver())->observe(
6258
function () use ($update): void {
6359
$operation = new Update(
@@ -148,24 +144,6 @@ function (array $event): void {
148144
);
149145
}
150146

151-
public function testHintOptionAndUnacknowledgedWriteConcernUnsupportedClientSideError(): void
152-
{
153-
$this->skipIfServerVersion('>=', '4.2.0', 'hint is supported');
154-
155-
$operation = new Update(
156-
$this->getDatabaseName(),
157-
$this->getCollectionName(),
158-
['_id' => 1],
159-
['$inc' => ['x' => 1]],
160-
['hint' => '_id_', 'writeConcern' => new WriteConcern(0)],
161-
);
162-
163-
$this->expectException(UnsupportedException::class);
164-
$this->expectExceptionMessage('Hint is not supported by the server executing this operation');
165-
166-
$operation->execute($this->getPrimaryServer());
167-
}
168-
169147
public function testUpdateOne(): void
170148
{
171149
$this->createFixtures(3);

tests/SpecTests/PrimaryStepDownSpecTest.php

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -72,43 +72,6 @@ public function testNotPrimaryKeepsConnectionPool(): void
7272
$this->assertSame($totalConnectionsCreated, $this->getTotalConnectionsCreated());
7373
}
7474

75-
/** @see https://github.com/mongodb/specifications/tree/master/source/connections-survive-step-down/tests#not-primary-reset-connection-pool */
76-
public function testNotPrimaryResetConnectionPool(): void
77-
{
78-
$runOn = [(object) ['minServerVersion' => '4.0.0', 'maxServerVersion' => '4.0.999', 'topology' => [self::TOPOLOGY_REPLICASET]]];
79-
$this->checkServerRequirements($runOn);
80-
81-
// Set a fail point
82-
$this->configureFailPoint([
83-
'configureFailPoint' => 'failCommand',
84-
'mode' => ['times' => 1],
85-
'data' => [
86-
'failCommands' => ['insert'],
87-
'errorCode' => self::NOT_PRIMARY,
88-
],
89-
]);
90-
91-
$totalConnectionsCreated = $this->getTotalConnectionsCreated();
92-
93-
// Execute an insert into the test collection of a {test: 1} document.
94-
try {
95-
$this->insertDocuments(1);
96-
} catch (BulkWriteException $e) {
97-
// Verify that the insert failed with an operation failure with 10107 code.
98-
$this->assertSame(self::NOT_PRIMARY, $e->getCode());
99-
}
100-
101-
/* Verify that the connection pool has been cleared and that a new
102-
* connection has been created. Use ">=" to allow for the possibility
103-
* that the server created additional connections unrelated to this
104-
* test. */
105-
$this->assertGreaterThanOrEqual($totalConnectionsCreated + 1, $this->getTotalConnectionsCreated());
106-
107-
// Execute an insert into the test collection of a {test: 1} document and verify that it succeeds.
108-
$result = $this->insertDocuments(1);
109-
$this->assertSame(1, $result->getInsertedCount());
110-
}
111-
11275
/** @see https://github.com/mongodb/specifications/tree/master/source/connections-survive-step-down/tests#shutdown-in-progress-reset-connection-pool */
11376
public function testShutdownResetConnectionPool(): void
11477
{

tests/UnifiedSpecTests/UnifiedTestRunner.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,6 @@ private function isAuthenticated(): bool
337337
*/
338338
private function isClientSideEncryptionSupported(): bool
339339
{
340-
/* CSFLE technically requires FCV 4.2+ but this is sufficient since we
341-
* do not test on mixed-version clusters. */
342-
if (version_compare($this->getServerVersion(), '4.2', '<')) {
343-
return false;
344-
}
345-
346340
if (FunctionalTestCase::getModuleInfo('libmongocrypt') === 'disabled') {
347341
return false;
348342
}

0 commit comments

Comments
 (0)