Skip to content

Commit

Permalink
exposed BSONRegExp type
Browse files Browse the repository at this point in the history
  • Loading branch information
christkv committed Mar 1, 2017
1 parent 10770ed commit a7fb4ea
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 16 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ connect.ObjectID = core.BSON.ObjectID;
connect.ObjectId = core.BSON.ObjectID;
connect.Symbol = core.BSON.Symbol;
connect.Timestamp = core.BSON.Timestamp;
connect.BSONRegExp = core.BSON.BSONRegExp;
connect.Decimal128 = core.BSON.Decimal128;

// Add connect method
Expand Down
62 changes: 62 additions & 0 deletions test/functional/ssl_mongoclient_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1149,3 +1149,65 @@ exports['should correctly connect using SSL to replicaset with requireSSL'] = {
});
}
}

// /**
// * @ignore
// */
// exports['should fail due to accessing using ip address'] = {
// metadata: { requires: { topology: 'ssl' } },
//
// // The actual test we wish to run
// test: function(configuration, test) {
// var ServerManager = require('mongodb-topology-manager').Server
// , MongoClient = configuration.require.MongoClient;
//
// // All inserted docs
// var docs = [];
// var errs = [];
// var insertDocs = [];
//
// // Read the ca
// var ca = [fs.readFileSync(__dirname + "/ssl/ca.pem")];
//
// // Start server
// var serverManager = new ServerManager('mongod', {
// journal:null
// , sslOnNormalPorts: null
// , sslPEMKeyFile: __dirname + "/ssl/server.pem"
// // EnsureUp options
// , dbpath: path.join(path.resolve('db'), f("data-%d", 27019))
// , bind_ip: 'server'
// , port: 27019
// });
//
// console.log("=============================== commandLine 0")
// // console.log(commandLine)
// serverManager.purge().then(function() {
// console.log("=============================== commandLine 1")
// // Start the server
// serverManager.start().then(function() {
// setTimeout(function() {
// console.log("=============================== commandLine 2")
// // Connect and validate the server certificate
// // MongoClient.connect("mongodb://127.0.0.1:27019/test?ssl=true&maxPoolSize=1", {
// // MongoClient.connect("mongodb://foo:bar@ds015564-a0.sjf52.fleet.mongolab.com:15564,ds015564-a1.sjf52.fleet.mongolab.com:15564/test?replicaSet=rs-ds015564&ssl=true", { // MongoClient.connect("mongodb://server:27019/test?ssl=true&maxPoolSize=1", {
// MongoClient.connect("mongodb://foo:bar@54.161.72.61:15564,54.204.126.162:15564/test?replicaSet=rs-ds015564&ssl=true", {
// sslValidate:true,
// // checkServerIdentity:true
// // , sslCA:ca
// }, function(err, db) {
// console.dir(err)
// test.equal(null, err);
// test.ok(db != null);
//
// db.close();
//
// serverManager.stop().then(function() {
// test.done();
// });
// });
// }, 1000);
// });
// });
// }
// }
21 changes: 5 additions & 16 deletions test/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ var Runner = require('integra').Runner
, Cover = require('integra').Cover
, RCover = require('integra').RCover
, f = require('util').format
, m = require('mongodb-version-manager')
, path = require('path')
, NodeVersionFilter = require('./filters/node_version_filter')
, MongoDBVersionFilter = require('./filters/mongodb_version_filter')
Expand Down Expand Up @@ -101,6 +100,7 @@ var Configuration = function(options) {
manager.discover().then(function(result) {
// Create string representation
var currentVersion = result.version.join('.');
console.log("==== Running against MongodDB " + currentVersion);
// If we have a ReplSetManager and the version is >= 3.4.0
if(semver.satisfies(currentVersion, ">=3.4.0")) {
if(manager instanceof ReplSetManager) {
Expand Down Expand Up @@ -141,28 +141,19 @@ var Configuration = function(options) {
},

stop: function(callback) {
// console.log("=================== STOP 0")
if(skipTermination) return callback();
// console.log("=================== STOP 1")
// Stop the servers
manager.stop(9).then(function() {
// console.log("=================== STOP 1")
callback();
});
},

restart: function(options, callback) {
// console.log("------------ restart 0")
// console.log("=================== RESTART 0")
if(typeof options == 'function') callback = options, options = {purge:true, kill:true};
// console.log("=================== RESTART 1")
if(skipTermination) return callback();
// console.log("=================== RESTART 2")
// console.log("------------ restart 1")

// Stop the servers
manager.restart().then(function() {
// console.log("=================== RESTART 3")
callback();
});
},
Expand Down Expand Up @@ -255,8 +246,8 @@ var Configuration = function(options) {

// Set up the runner
var runner = new Runner({
// logLevel:'error'
logLevel:'info'
logLevel:'error'
// logLevel:'info'
, runners: 1
, failFast: true
});
Expand Down Expand Up @@ -468,15 +459,14 @@ if(argv.t == 'functional') {
return runner.run(Configuration(_config));
}

// console.log("!!!!!!!!!!! RUN 0")
// Get the mongodb-version-manager
var m = require('mongodb-version-manager');
// Kill any running MongoDB processes and
// `install $MONGODB_VERSION` || `use existing installation` || `install stable`
m(function(err){
// console.log("!!!!!!!!!!! RUN 1")
if(err) return console.error(err) && process.exit(1);

m.current(function(err, version){
// console.log("!!!!!!!!!!! RUN 2")
if(err) return console.error(err) && process.exit(1);
console.log('Running tests against MongoDB version `%s`', version);
// Run the configuration
Expand All @@ -488,7 +478,6 @@ if(argv.t == 'functional') {
//
// Replicaset configuration
if(argv.e == 'replicaset') {
// console.log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
// Establish the server version
new ServerManager('mongod').discover().then(function(r) {
// The individual nodes
Expand Down

0 comments on commit a7fb4ea

Please sign in to comment.