Skip to content

Commit

Permalink
test(change-streams): reenable test validating ReadPreference
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst committed Dec 4, 2017
1 parent 9e06d5f commit aa5e705
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/change_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var ChangeStream = function(collection, pipeline, options) {
self.serverConfig = collection.s.db.serverConfig;

// Determine correct read preference
// self.options.readPreference = self.options.readPreference || collection.s.readPreference;
self.options.readPreference = self.options.readPreference || collection.s.readPreference;

// Create contained Change Stream cursor
self.cursor = createChangeStreamCursor(self);
Expand Down
8 changes: 5 additions & 3 deletions test/functional/change_stream_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,7 @@ describe('Change Streams', function() {
}
});

it.skip('Should create Change Streams with correct read preferences', {
it('Should create Change Streams with correct read preferences', {
metadata: { requires: { topology: 'replicaset', mongodb: '>=3.5.10' } },

// The actual test we wish to run
Expand All @@ -1216,6 +1216,7 @@ describe('Change Streams', function() {
var database = client.db('integration_tests', {
readPreference: ReadPreference.PRIMARY_PREFERRED
});

var changeStream0 = database.collection('docs0').watch(pipeline);
assert.deepEqual(
changeStream0.cursor.readPreference.preference,
Expand All @@ -1226,6 +1227,7 @@ describe('Change Streams', function() {
var collection = database.collection('docs1', {
readPreference: ReadPreference.SECONDARY_PREFERRED
});

var changeStream1 = collection.watch(pipeline);
assert.deepEqual(
changeStream1.cursor.readPreference.preference,
Expand Down Expand Up @@ -1430,10 +1432,10 @@ describe('Change Streams', function() {

var parsedFileContents = JSON.parse(fileContents);
assert.equal(parsedFileContents.fullDocument.a, 1);


watcher.close();

thisChangeStream.close(function(err) {
assert.ifError(err);

Expand Down

0 comments on commit aa5e705

Please sign in to comment.