Skip to content
Browse files

Added initial files

  • Loading branch information...
1 parent 0d013ce commit fd533b565268acd2c108b3da3d52687b0a996823 @christkv committed May 11, 2012
Showing with 131 additions and 1 deletion.
  1. +2 −1 .gitignore
  2. +21 −0 package.json
  3. +39 −0 run.js
  4. +69 −0 tests/find_benchmarks_test.js
View
3 .gitignore
@@ -10,6 +10,7 @@ lib-cov
pids
logs
results
+node-mongodb-native
node_modules
-npm-debug.log
+npm-debug.log
View
21 package.json
@@ -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" } ]
+}
View
39 run.js
@@ -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
+})
View
69 tests/find_benchmarks_test.js
@@ -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.
Something went wrong with that request. Please try again.