Skip to content

Commit b27ba3b

Browse files
committed
test: remaining tests
1 parent f3a56dd commit b27ba3b

File tree

11 files changed

+44
-84
lines changed

11 files changed

+44
-84
lines changed

test/integration/change-streams/change_stream.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1255,7 +1255,6 @@ describe('Change Streams', function () {
12551255

12561256
UnifiedTestSuiteBuilder.describe('document shapes')
12571257
.runOnRequirement({
1258-
minServerVersion: '4.0.0',
12591258
auth: true,
12601259
// Running on replicaset because other topologies are finiky with the cluster-wide events
12611260
// Dropping and renaming and creating collections in order to achieve a clean slate isn't worth the goal of these tests

test/integration/change-streams/change_streams.prose.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,10 @@ describe('Change Stream prose tests', function () {
332332
}
333333

334334
// 11. For a ChangeStream under these conditions:
335-
// Running against a server >=4.0.7.
336335
// The batch is empty or has been iterated to the last document.
337336
// Expected result:
338337
// getResumeToken must return the postBatchResumeToken from the current command response.
339-
describe('for emptied batch on server >= 4.0.7', function () {
338+
describe('for emptied batch on server', function () {
340339
it('must return the postBatchResumeToken from the current command response', function () {
341340
const manager = new MockServerManager(this.configuration, {
342341
aggregate: (function* () {

test/integration/connections-survive-step-down/connections_survive_step_down.prose.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ describe('Connections Survive Primary Step Down - prose', function () {
140140

141141
context(
142142
'Shutdown in progress - Reset Connection Pool',
143-
{ requires: { mongodb: '>=4.0', topology: ['replicaset'] } },
143+
{ requires: { topology: ['replicaset'] } },
144144
() => {
145145
// This test should be run on all server versions >= 4.0.
146146

@@ -168,7 +168,7 @@ describe('Connections Survive Primary Step Down - prose', function () {
168168

169169
context(
170170
'Interrupted at shutdown - Reset Connection Pool',
171-
{ requires: { mongodb: '>=4.0', topology: ['replicaset'] } },
171+
{ requires: { topology: ['replicaset'] } },
172172
() => {
173173
// This test should be run on all server versions >= 4.0.
174174

test/integration/crud/aggregation.test.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,26 +72,23 @@ describe('Aggregation', function () {
7272
});
7373
});
7474

75-
it('should correctly execute db.aggregate() with $currentOp', {
76-
metadata: { requires: { mongodb: '>=4.0.0' } },
77-
test: function (done) {
78-
const client = this.configuration.newClient({ w: 1 }, { maxPoolSize: 1 });
75+
it('should correctly execute db.aggregate() with $currentOp', function (done) {
76+
const client = this.configuration.newClient({ w: 1 }, { maxPoolSize: 1 });
7977

80-
const db = client.db('admin');
81-
const cursor = db.aggregate([{ $currentOp: { localOps: true } }]);
78+
const db = client.db('admin');
79+
const cursor = db.aggregate([{ $currentOp: { localOps: true } }]);
8280

83-
cursor.toArray((err, result) => {
84-
expect(err).to.not.exist;
81+
cursor.toArray((err, result) => {
82+
expect(err).to.not.exist;
8583

86-
const aggregateOperation = result.filter(op => op.command && op.command.aggregate)[0];
87-
expect(aggregateOperation.command.aggregate).to.equal(1);
88-
expect(aggregateOperation.command.pipeline).to.eql([{ $currentOp: { localOps: true } }]);
89-
expect(aggregateOperation.command.cursor).to.deep.equal({});
90-
expect(aggregateOperation.command['$db']).to.equal('admin');
84+
const aggregateOperation = result.filter(op => op.command && op.command.aggregate)[0];
85+
expect(aggregateOperation.command.aggregate).to.equal(1);
86+
expect(aggregateOperation.command.pipeline).to.eql([{ $currentOp: { localOps: true } }]);
87+
expect(aggregateOperation.command.cursor).to.deep.equal({});
88+
expect(aggregateOperation.command['$db']).to.equal('admin');
9189

92-
client.close(done);
93-
});
94-
}
90+
client.close(done);
91+
});
9592
});
9693

9794
it('should fail when executing simple aggregation pipeline using arguments not an array', function (done) {

test/integration/crud/crud.prose.test.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('CRUD Prose Spec Tests', () => {
3232
});
3333

3434
// TODO(NODE-3888): Implement this test
35-
it.skip('1. WriteConcernError.details exposes writeConcernError.errInfo', {
35+
it.skip('1. WriteConcernError.details exposes writeConcernError.errInfo', async function () {
3636
/**
3737
* Test that writeConcernError.errInfo in a command response is propagated as WriteConcernError.details (or equivalent) in the driver.
3838
* Using a 4.0+ server, set the following failpoint:
@@ -62,10 +62,7 @@ describe('CRUD Prose Spec Tests', () => {
6262
* Then, perform an insert operation and assert that a WriteConcernError occurs and that
6363
* its details property is both accessible and matches the errInfo object from the failpoint.
6464
*/
65-
metadata: { requires: { mongodb: '>=4.0.0' } },
66-
async test() {
67-
throw new Error('This test is not implemented!');
68-
}
65+
throw new Error('This test is not implemented!');
6966
}).skipReason = 'TODO(NODE-3888): Implement this test';
7067

7168
describe('2. WriteError.details exposes writeErrors[].errInfo', () => {

test/integration/crud/find_and_modify.test.ts

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -347,27 +347,15 @@ describe('Collection (#findOneAnd...)', function () {
347347
await client?.close();
348348
});
349349

350-
it(
351-
'the aggregation pipeline updates the matching document',
352-
{
353-
requires: {
354-
mongodb: '>4.0'
355-
}
356-
},
357-
async function () {
358-
const {
359-
value: { _id, ...document }
360-
} = await collection.findOneAndUpdate(
361-
{ a: 1 },
362-
[{ $set: { a: { $add: [1, '$a'] } } }],
363-
{
364-
includeResultMetadata: true,
365-
returnDocument: 'after'
366-
}
367-
);
368-
expect(document).to.deep.equal({ a: 2, b: 1 });
369-
}
370-
);
350+
it('the aggregation pipeline updates the matching document', async function () {
351+
const {
352+
value: { _id, ...document }
353+
} = await collection.findOneAndUpdate({ a: 1 }, [{ $set: { a: { $add: [1, '$a'] } } }], {
354+
includeResultMetadata: true,
355+
returnDocument: 'after'
356+
});
357+
expect(document).to.deep.equal({ a: 2, b: 1 });
358+
});
371359
});
372360

373361
context('when passing includeResultMetadata: false', function () {
@@ -385,22 +373,14 @@ describe('Collection (#findOneAnd...)', function () {
385373
await client?.close();
386374
});
387375

388-
it(
389-
'the aggregation pipeline updates the matching document',
390-
{
391-
requires: {
392-
mongodb: '>4.0'
393-
}
394-
},
395-
async function () {
396-
const { _id, ...document } = await collection.findOneAndUpdate(
397-
{ a: 1 },
398-
[{ $set: { a: { $add: [1, '$a'] } } }],
399-
{ returnDocument: 'after' }
400-
);
401-
expect(document).to.deep.equal({ a: 2, b: 1 });
402-
}
403-
);
376+
it('the aggregation pipeline updates the matching document', async function () {
377+
const { _id, ...document } = await collection.findOneAndUpdate(
378+
{ a: 1 },
379+
[{ $set: { a: { $add: [1, '$a'] } } }],
380+
{ returnDocument: 'after' }
381+
);
382+
expect(document).to.deep.equal({ a: 2, b: 1 });
383+
});
404384
});
405385
});
406386
});

test/integration/enumerate_databases.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { TestBuilder, UnifiedTestSuiteBuilder } from '../tools/utils';
66

77
const metadata: MongoDBMetadataUI = {
88
requires: {
9-
mongodb: '>=4.0.6',
109
auth: 'enabled',
1110

1211
// 'TODO: NODE-3891 - fix tests broken when AUTH enabled'

test/integration/index_management.test.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -358,18 +358,10 @@ describe('Indexes', function () {
358358
});
359359
});
360360

361-
it(
362-
'should return false',
363-
{
364-
requires: {
365-
mongodb: '>4.0'
366-
}
367-
},
368-
async function () {
369-
const result = await collection.dropIndexes();
370-
expect(result).to.equal(false);
371-
}
372-
);
361+
it('should return false', async function () {
362+
const result = await collection.dropIndexes();
363+
expect(result).to.equal(false);
364+
});
373365
});
374366

375367
context('indexExists', function () {

test/integration/node-specific/bson-options/promote_buffers.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,7 @@ describe('Promote Buffers', function () {
150150
// in this case we are setting that node needs to be higher than 0.10.X to run
151151
metadata: {
152152
requires: {
153-
topology: ['single', 'replicaset', 'sharded', 'ssl', 'heap', 'wiredtiger'],
154-
mongodb: '>=2.4.0'
153+
topology: ['single', 'replicaset', 'sharded', 'ssl', 'heap', 'wiredtiger']
155154
}
156155
},
157156

test/integration/server-selection/operation_count.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@ import { type FailPoint } from '../../tools/utils';
1111

1212
const testMetadata: MongoDBMetadataUI = {
1313
requires: {
14-
topology: 'single',
15-
mongodb: '>=4.0.0'
14+
topology: 'single'
1615
}
1716
};
1817

1918
const loadBalancedTestMetadata: MongoDBMetadataUI = {
2019
requires: {
21-
topology: 'load-balanced',
22-
mongodb: '>=4.0.0'
20+
topology: 'load-balanced'
2321
}
2422
};
2523

0 commit comments

Comments
 (0)