Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: ensure connection with sharded topology #2579

Merged
merged 1 commit into from
Oct 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions test/functional/sharding_connection.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict';

const withClient = require('./shared').withClient;
const setupDatabase = require('./shared').setupDatabase;
const expect = require('chai').expect;
const TopologyType = require('../../lib/sdam/common').TopologyType;

describe('Sharding (Connection)', function () {
before(function () {
return setupDatabase(this.configuration);
});

it('Should use sharded topology', {
metadata: { requires: { topology: 'sharded' } },
test: function () {
const client = this.configuration.newClient({});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this necessary? If you're not passing custom options into this.configuration.newClient, this should be the same as test: withClient((client, done) => {...})

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated! This is a port, and I believe I needed to pass in useUnifiedTopology in 3.6 and that's why I did it this way, but then possibly removed the option here because of the warning?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damn, i missed this push locally. I think it's OK to leave in, hope we revamp and check through withClient calls later.

return withClient(client, (client, done) => {
expect(client).to.exist;
expect(client).nested.property('topology.description.type').to.equal(TopologyType.Sharded);
return done();
})();
}
});
});