diff --git a/test/functional/collations.test.js b/test/functional/collations.test.js index 250fa73d5f..a7b732a220 100644 --- a/test/functional/collations.test.js +++ b/test/functional/collations.test.js @@ -393,77 +393,6 @@ describe('Collation', function () { } }); - it('Fail due to no support for collation', { - metadata: { requires: { generators: true, topology: 'single' } }, - - test: function () { - const configuration = this.configuration; - const client = configuration.newClient(`mongodb://${testContext.server.uri()}/test`); - const primary = [Object.assign({}, mock.DEFAULT_ISMASTER, { maxWireVersion: 4 })]; - - testContext.server.setMessageHandler(request => { - const doc = request.document; - if (doc.ismaster || doc.hello) { - request.reply(primary[0]); - } else if (doc.find) { - request.reply({ ok: 1 }); - } else if (doc.endSessions) { - request.reply({ ok: 1 }); - } - }); - - return client.connect().then(() => { - const db = client.db(configuration.db); - - return db - .collection('test') - .findOne({ a: 1 }, { collation: { caseLevel: true } }) - .then(() => Promise.reject('this test should fail')) - .catch(err => { - expect(err).to.exist; - expect(err.message).to.match(/does not support collation/); - return client.close(); - }); - }); - } - }); - - it('Fail command due to no support for collation', { - metadata: { requires: { generators: true, topology: 'single' } }, - test: function () { - const configuration = this.configuration; - const client = configuration.newClient(`mongodb://${testContext.server.uri()}/test`); - const primary = [Object.assign({}, mock.DEFAULT_ISMASTER, { maxWireVersion: 4 })]; - - testContext.server.setMessageHandler(request => { - var doc = request.document; - if (doc.ismaster || doc.hello) { - request.reply(primary[0]); - } else if (doc.find) { - request.reply({ ok: 1 }); - } else if (doc.endSessions) { - request.reply({ ok: 1 }); - } - }); - - return client.connect().then(() => { - const db = client.db(configuration.db); - - return db - .command({ count: 'test', query: {}, collation: { caseLevel: true } }) - .then(() => Promise.reject('should not succeed')) - .catch(err => { - expect(err).to.exist; - expect(err.message).to.equal( - `Server ${testContext.server.uri()} does not support collation` - ); - - return client.close(); - }); - }); - } - }); - it('Successfully pass through collation to bulkWrite command', { metadata: { requires: { generators: true, topology: 'single' } }, test: function () { @@ -518,107 +447,6 @@ describe('Collation', function () { } }); - it('Successfully fail bulkWrite due to unsupported collation in update', { - metadata: { requires: { generators: true, topology: 'single' } }, - test: function () { - const configuration = this.configuration; - const client = configuration.newClient(`mongodb://${testContext.server.uri()}/test`); - const primary = [Object.assign({}, mock.DEFAULT_ISMASTER, { maxWireVersion: 4 })]; - - testContext.server.setMessageHandler(request => { - const doc = request.document; - if (doc.ismaster || doc.hello) { - request.reply(primary[0]); - } else if (doc.update) { - request.reply({ ok: 1 }); - } else if (doc.delete) { - request.reply({ ok: 1 }); - } else if (doc.endSessions) { - request.reply({ ok: 1 }); - } - }); - - return client.connect().then(() => { - const db = client.db(configuration.db); - - return db - .collection('test') - .bulkWrite( - [ - { - updateOne: { - filter: { a: 2 }, - update: { $set: { a: 2 } }, - upsert: true, - collation: { caseLevel: true } - } - }, - { deleteOne: { filter: { c: 1 } } } - ], - { ordered: true } - ) - .then(() => { - throw new Error('should not succeed'); - }) - .catch(err => { - expect(err).to.exist; - expect(err.message).to.match(/does not support collation/); - }) - .then(() => client.close()); - }); - } - }); - - it('Successfully fail bulkWrite due to unsupported collation in delete', { - metadata: { requires: { generators: true, topology: 'single' } }, - test: function () { - const configuration = this.configuration; - const client = configuration.newClient(`mongodb://${testContext.server.uri()}/test`); - const primary = [Object.assign({}, mock.DEFAULT_ISMASTER, { maxWireVersion: 4 })]; - - testContext.server.setMessageHandler(request => { - const doc = request.document; - if (doc.ismaster || doc.hello) { - request.reply(primary[0]); - } else if (doc.update) { - request.reply({ ok: 1 }); - } else if (doc.delete) { - request.reply({ ok: 1 }); - } else if (doc.endSessions) { - request.reply({ ok: 1 }); - } - }); - - return client.connect().then(() => { - const db = client.db(configuration.db); - - return db - .collection('test') - .bulkWrite( - [ - { - updateOne: { - filter: { a: 2 }, - update: { $set: { a: 2 } }, - upsert: true - } - }, - { deleteOne: { filter: { c: 1 }, collation: { caseLevel: true } } } - ], - { ordered: true } - ) - .then(() => { - throw new Error('should not succeed'); - }) - .catch(err => { - expect(err).to.exist; - expect(err.message).to.match(/does not support collation/); - }) - .then(() => client.close()); - }); - } - }); - it('Successfully create index with collation', { metadata: { requires: { generators: true, topology: 'single' } }, test: function () { @@ -657,75 +485,6 @@ describe('Collation', function () { } }); - it('Fail to create index with collation due to no capabilities', { - metadata: { requires: { generators: true, topology: 'single' } }, - - test: function () { - const configuration = this.configuration; - const client = configuration.newClient(`mongodb://${testContext.server.uri()}/test`); - const primary = [Object.assign({}, mock.DEFAULT_ISMASTER, { maxWireVersion: 4 })]; - - testContext.server.setMessageHandler(request => { - const doc = request.document; - if (doc.ismaster || doc.hello) { - request.reply(primary[0]); - } else if (doc.createIndexes) { - request.reply({ ok: 1 }); - } else if (doc.endSessions) { - request.reply({ ok: 1 }); - } - }); - - return client.connect().then(() => { - const db = client.db(configuration.db); - - return db - .collection('test') - .createIndex({ a: 1 }, { collation: { caseLevel: true } }) - .then(() => Promise.reject('should not succeed')) - .catch(err => { - expect(err).to.exist; - expect(err.message).to.match(/does not support collation$/); - }) - .then(() => client.close()); - }); - } - }); - - it('Fail to create indexs with collation due to no capabilities', { - metadata: { requires: { generators: true, topology: 'single' } }, - - test: function () { - const configuration = this.configuration; - const client = configuration.newClient(`mongodb://${testContext.server.uri()}/test`); - const primary = [Object.assign({}, mock.DEFAULT_ISMASTER, { maxWireVersion: 4 })]; - - testContext.server.setMessageHandler(request => { - const doc = request.document; - if (doc.ismaster || doc.hello) { - request.reply(primary[0]); - } else if (doc.createIndexes) { - request.reply({ ok: 1 }); - } else if (doc.endSessions) { - request.reply({ ok: 1 }); - } - }); - - return client.connect().then(() => { - const db = client.db(configuration.db); - - return db - .collection('test') - .createIndexes([{ key: { a: 1 }, collation: { caseLevel: true } }]) - .then(() => Promise.reject('should not succeed')) - .catch(err => { - expect(err.message).to.match(/does not support collation$/); - return client.close(); - }); - }); - } - }); - it('cursor count method should return the correct number when used with collation set', { metadata: { requires: { mongodb: '>=3.4.0' } }, test: function (done) {