Permalink
Browse files

Fixed replicaset test to correctly identify buy in count, merged in f…

…ix from year2013
  • Loading branch information...
1 parent 17b7883 commit ffdd2bf0797419083809b51efd69178ccb5d6234 @christkv christkv committed Aug 11, 2011
Showing with 64 additions and 60 deletions.
  1. +2 −1 HISTORY
  2. +1 −1 package.json
  3. +56 −53 test/replicaset/query_secondaries_test.js
  4. +5 −5 tools/test_all.js
View
@@ -1,9 +1,10 @@
-
+0.9.6-10 2011-08-11
* Specific type Double for capped collections (https://github.com/mbostock), Issue #312
* Decorating Errors with all all object info from Mongo (https://github.com/laurie71), Issue #308
* Implementing fixes for mongodb 1.9.1 and higher to make tests pass
* Admin validateCollection now takes an options argument for you to pass in full option
* Implemented keepGoing parameter for mongodb 1.9.1 or higher, Issue #310
+* Added test for read_secondary count issue, merged in fix from (https://github.com/year2013), Issue #317
0.9.6-9
* Bug fix for bson parsing the key '':'' correctly without crashing
View
@@ -1,6 +1,6 @@
{ "name" : "mongodb"
, "description" : "A node.js driver for MongoDB"
-, "version" : "0.9.6-9"
+, "version" : "0.9.6-10"
, "author" : "Christian Amor Kvalheim <christkv@gmail.com>"
, "contributors" : [ "Aaron Heckmann",
"Christoph Pojer",
@@ -67,55 +67,55 @@ module.exports = testCase({
})
},
- // shouldReadPrimary : function(test) {
- // // debug("=========================================== shouldReadPrimary")
- // // Replica configuration
- // var replSet = new ReplSetServers( [
- // new Server( RS.host, RS.ports[0], { auto_reconnect: true } ),
- // ],
- // {rs_name:RS.name, read_secondary:true}
- // );
- //
- // // Insert some data
- // var db = new Db('integration_test_', replSet);
- // db.open(function(err, p_db) {
- // if(err != null) debug("shouldReadPrimary :: " + inspect(err));
- // // Drop collection on replicaset
- // p_db.dropCollection('testsets', function(err, r) {
- // if(err != null) debug("shouldReadPrimary :: " + inspect(err));
- //
- // test.equal(false, p_db.serverConfig.isReadPrimary());
- // test.equal(false, p_db.serverConfig.isPrimary());
- // test.done();
- // });
- // })
- // },
- //
- // shouldCorrectlyTestConnection : function(test) {
- // // debug("=========================================== shouldCorrectlyTestConnection")
- // // Replica configuration
- // var replSet = new ReplSetServers( [
- // new Server( RS.host, RS.ports[0], { auto_reconnect: true } ),
- // ],
- // {rs_name:RS.name, read_secondary:true}
- // );
- //
- // // Insert some data
- // var db = new Db('integration_test_', replSet);
- // db.open(function(err, p_db) {
- // if(err != null) debug("shouldReadPrimary :: " + inspect(err));
- //
- // // Drop collection on replicaset
- // p_db.dropCollection('testsets', function(err, r) {
- // if(err != null) debug("shouldReadPrimary :: " + inspect(err));
- //
- // test.ok(p_db.serverConfig.primary != null);
- // test.ok(p_db.serverConfig.read != null);
- // test.ok(p_db.serverConfig.primary.port != p_db.serverConfig.read.port);
- // test.done();
- // });
- // })
- // },
+ shouldReadPrimary : function(test) {
+ // debug("=========================================== shouldReadPrimary")
+ // Replica configuration
+ var replSet = new ReplSetServers( [
+ new Server( RS.host, RS.ports[0], { auto_reconnect: true } ),
+ ],
+ {rs_name:RS.name, read_secondary:true}
+ );
+
+ // Insert some data
+ var db = new Db('integration_test_', replSet);
+ db.open(function(err, p_db) {
+ if(err != null) debug("shouldReadPrimary :: " + inspect(err));
+ // Drop collection on replicaset
+ p_db.dropCollection('testsets', function(err, r) {
+ if(err != null) debug("shouldReadPrimary :: " + inspect(err));
+
+ test.equal(false, p_db.serverConfig.isReadPrimary());
+ test.equal(false, p_db.serverConfig.isPrimary());
+ test.done();
+ });
+ })
+ },
+
+ shouldCorrectlyTestConnection : function(test) {
+ // debug("=========================================== shouldCorrectlyTestConnection")
+ // Replica configuration
+ var replSet = new ReplSetServers( [
+ new Server( RS.host, RS.ports[0], { auto_reconnect: true } ),
+ ],
+ {rs_name:RS.name, read_secondary:true}
+ );
+
+ // Insert some data
+ var db = new Db('integration_test_', replSet);
+ db.open(function(err, p_db) {
+ if(err != null) debug("shouldReadPrimary :: " + inspect(err));
+
+ // Drop collection on replicaset
+ p_db.dropCollection('testsets', function(err, r) {
+ if(err != null) debug("shouldReadPrimary :: " + inspect(err));
+
+ test.ok(p_db.serverConfig.primary != null);
+ test.ok(p_db.serverConfig.read != null);
+ test.ok(p_db.serverConfig.primary.port != p_db.serverConfig.read.port);
+ test.done();
+ });
+ })
+ },
shouldCorrectlyQuerySecondaries : function(test) {
// debug("=========================================== shouldCorrectlyQuerySecondaries")
@@ -197,10 +197,13 @@ module.exports = testCase({
}
});
}, function(err, result) {
- test.ifError(err);
-
- test.done();
- p_db.close();
+ // Check if we get a correct count
+ collection.count(function(err, count) {
+ test.ifError(err);
+ test.equal(3, count)
+ test.done();
+ p_db.close();
+ });
})
});
}, 2000);
View
@@ -80,11 +80,11 @@ exec('rm -rf ./output', function(err, stdout, stderr) {
runner.run(files, options, this);
},
// Run all integration tests using the native bson parser
- function runNativeJS() {
- process.env['TEST_NATIVE'] = 'TRUE';
- options.suffix = 'native';
- runner.run(files, options, this);
- },
+ // function runNativeJS() {
+ // process.env['TEST_NATIVE'] = 'TRUE';
+ // options.suffix = 'native';
+ // runner.run(files, options, this);
+ // },
// Execute all the replicaset tests
function executeReplicaSetTests() {
runner.run(replicasetFiles, options, this);

0 comments on commit ffdd2bf

Please sign in to comment.