Skip to content

Commit

Permalink
Added initial files
Browse files Browse the repository at this point in the history
  • Loading branch information
christkv committed May 11, 2012
1 parent 0d013ce commit fd533b5
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ lib-cov
pids
logs
results
node-mongodb-native

node_modules
npm-debug.log
npm-debug.log
21 changes: 21 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"author": "Christian Kvalheim <christkv@10gen.com> (http://www.christiankvalheim.com)",
"name": "mongodb-node-regression-benchmarks",
"description": "Performance regression tests for node.js mongodb driver",
"version": "0.0.1",
"repository": {
"type": "git",
"url": "git://github.com/christkv/mongodb-node-regression-benchmarks.git"
},
"dependencies": {},
"devDependencies": {
"nodeunit": "0.7.4"
},
"scripts": { "test" : "node run.js" },
"optionalDependencies": {},
"engines": {
"node": "*"
},
"licenses" : [ { "type" : "Apache License, Version 2.0",
"url" : "http://www.apache.org/licenses/LICENSE-2.0" } ]
}
39 changes: 39 additions & 0 deletions run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
var spawn = require('child_process').spawn;

//
// Run the test suite multiple times, one for the 0.9.8.X, 0.9.9.X and 1.0.X, and master
//

// Start by fetch the git repo, the run the tests on different tags + master
//https://github.com/mongodb/node-mongodb-native
var fetchGitRepo = function(branch, callback) {
// Remove the directory if it exists
var rm = spawn("rm", ["-rf", "./node-mongodb-native"]);
rm.on("exit", function() {
// Set up git repo command
var git = spawn("git", ["clone", "https://github.com/mongodb/node-mongodb-native.git"]);
git.stdout.on("data", function (data) { process.stdout.write(data); });
git.stderr.on("data", function (data) { process.stdout.write(data); });

// Execute the git fetch command
git.on("exit", function() {
// Let's switch the tag
git = spawn("git", ["--exec-path=./node-mongodb-native", "--git-dir=./node-mongodb-native/.git", "checkout", branch]);
git.stdout.on("data", function (data) { process.stdout.write(data); });
git.stderr.on("data", function (data) { process.stdout.write(data); });
// Execute the git fetch command
git.on("exit", function() {
callback();
});
});
});
}

var executeBenchmarks = function(branch, callback) {
// We fetch a git repository
}

// Fetch the git repo
fetchGitRepo("V0.9.8", function() {
// Execute benchmarks against a specific tag or branch
})
69 changes: 69 additions & 0 deletions tests/find_benchmarks_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
var mongodb = process.env['TEST_NATIVE'] != null ? require('../lib/mongodb').native() : require('../lib/mongodb').pure();
var useSSL = process.env['USE_SSL'] != null ? true : false;
var native_parser = (process.env['TEST_NATIVE'] != null);

/*!
* Module dependencies.
*/
var testCase = require('nodeunit').testCase,
nodeunit = require('nodeunit'),
Db = mongodb.Db,
Cursor = mongodb.Cursor,
Collection = mongodb.Collection,
Server = mongodb.Server;

var MONGODB = 'integration_tests';
var client = null;

/**
* Retrieve the server information for the current
* instance of the db client
*
* @ignore
*/
exports.setUp = function(callback) {
var self = exports;
client = new Db(MONGODB, new Server("127.0.0.1", 27017, {auto_reconnect: true, poolSize: 4, ssl:useSSL}), {native_parser: (process.env['TEST_NATIVE'] != null)});
client.open(function(err, db_p) {
if(numberOfTestsRun == (Object.keys(self).length)) {
// If first test drop the db
client.dropDatabase(function(err, done) {
callback();
});
} else {
return callback();
}
});
}

/**
* Retrieve the server information for the current
* instance of the db client
*
* @ignore
*/
exports.tearDown = function(callback) {
var self = this;
numberOfTestsRun = numberOfTestsRun - 1;
// Close connection
client.close();
callback();
}

/**
* Should insert 1000 documents and then fetch it back around 10000 times to calculate performance
*
* @ignore
*/
exports.shouldExerciseToArrayFunctionOnQueries = function(test) {
test.done();
}









0 comments on commit fd533b5

Please sign in to comment.