Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added proper error message if no valid serverConfig can be created, I…

…ssue #798
  • Loading branch information...
commit beadb0208c98cc80b57dfd43b9aeba56f1ae19c5 1 parent 53dbc6c
@christkv christkv authored
View
5 HISTORY
@@ -1,3 +1,8 @@
+1.2.5 2012-12-12
+----------------
+- Fixed ssl regression, added more test coverage (Issue #800)
+- Added better error reporting to the Db.connect if no valid serverConfig setup found (Issue #798)
+
1.2.4 2012-12-11
----------------
- Fix to ensure authentication is correctly applied across all secondaries when using MongoClient.
View
1  lib/mongodb/db.js
@@ -2054,6 +2054,7 @@ Db.connect = function(url, options, callback) {
}), object.mongos_options);
}
+ if(serverConfig == null) return callback(new Error("Could not locate any valid servers in initial seed list"));
// Set up all options etc and connect to the database
_finishConnecting(serverConfig, object, options, callback)
}
View
2  package.json
@@ -1,7 +1,7 @@
{ "name" : "mongodb"
, "description" : "A node.js driver for MongoDB"
, "keywords" : ["mongodb", "mongo", "driver", "db"]
-, "version" : "1.2.4"
+, "version" : "1.2.5"
, "author" : "Christian Amor Kvalheim <christkv@gmail.com>"
, "contributors" : [ "Aaron Heckmann",
"Christoph Pojer",
View
23 test/replicaset/mongo_client_test.js
@@ -62,7 +62,7 @@ exports.setUp = function(callback) {
// Create instance of replicaset manager but only for the first call
if(!serversUp && !noReplicasetStart) {
serversUp = true;
- RS = new ReplicaSetManager({retries:120, secondary_count:1, passive_count:0, arbiter_count:0});
+ RS = new ReplicaSetManager({retries:120, secondary_count:2, passive_count:1, arbiter_count:1});
// RS = new ReplicaSetManager({retries:120, secondary_count:1, passive_count:0, arbiter_count:0});
RS.startSet(true, function(err, result) {
if(err != null) throw err;
@@ -158,7 +158,7 @@ exports['Should correctly connect to a replicaset with readPreference set'] = fu
, "localhost:30001"
, "integration_test_"
, RS.name
- , "secondaryPreferred");
+ , "primary");
MongoClient.connect(url, function(err, db) {
test.equal(null, err);
@@ -173,15 +173,20 @@ exports['Should correctly connect to a replicaset with readPreference set'] = fu
}
/**
- * Retrieve the server information for the current
- * instance of the db client
- *
* @ignore
*/
-exports.noGlobalsLeaked = function(test) {
- var leaks = gleak.detectNew();
- test.equal(0, leaks.length, "global var leak detected: " + leaks.join(', '));
- test.done();
+exports['Should give an error for non-existing servers'] = function(test) {
+ var url = format("mongodb://%s,%s/%s?replicaSet=%s&readPreference=%s"
+ , "nolocalhost:30000"
+ , "nolocalhost:30001"
+ , "integration_test_"
+ , RS.name
+ , "primary");
+
+ MongoClient.connect(url, function(err, db) {
+ test.ok(err != null);
+ test.done();
+ });
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.