From 3c9f8d7175ef7d07b9b83c5863b273428608c6b0 Mon Sep 17 00:00:00 2001 From: Dan Aprahamian Date: Fri, 22 Mar 2019 16:48:06 -0400 Subject: [PATCH] chore: delete old files that are no longer used Fixes NODE-1907 --- boot_auth.js | 52 ---------- insert_bench.js | 231 ------------------------------------------- test/smoke_plugin.js | 61 ------------ 3 files changed, 344 deletions(-) delete mode 100644 boot_auth.js delete mode 100644 insert_bench.js delete mode 100644 test/smoke_plugin.js diff --git a/boot_auth.js b/boot_auth.js deleted file mode 100644 index 95956c7a52..0000000000 --- a/boot_auth.js +++ /dev/null @@ -1,52 +0,0 @@ -var ReplSetManager = require('mongodb-topology-manager').ReplSet, - f = require('util').format; - -var rsOptions = { - server: { - keyFile: __dirname + '/test/functional/data/keyfile.txt', - auth: null, - replSet: 'rs' - }, - client: { - replSet: 'rs' - } -} - -// Set up the nodes -var nodes = [{ - options: { - bind_ip: 'localhost', port: 31000, - dbpath: f('%s/../db/31000', __dirname), - } -}, { - options: { - bind_ip: 'localhost', port: 31001, - dbpath: f('%s/../db/31001', __dirname), - } -}, { - options: { - bind_ip: 'localhost', port: 31002, - dbpath: f('%s/../db/31002', __dirname), - } -}] - -// Merge in any node start up options -for(var i = 0; i < nodes.length; i++) { - for(var name in rsOptions.server) { - nodes[i].options[name] = rsOptions.server[name]; - } -} - -// Create a manager -var replicasetManager = new ReplSetManager('mongod', nodes, rsOptions.client); -// Purge the set -replicasetManager.purge().then(function() { - // Start the server - replicasetManager.start().then(function() { - process.exit(0); - }).catch(function(e) { - console.log("====== ") - console.dir(e) - // // console.dir(e); - }); -}); diff --git a/insert_bench.js b/insert_bench.js deleted file mode 100644 index 5c4d0b9ef1..0000000000 --- a/insert_bench.js +++ /dev/null @@ -1,231 +0,0 @@ -var MongoClient = require('./').MongoClient, - assert = require('assert'); - -// var memwatch = require('memwatch-next'); -// memwatch.on('leak', function(info) { -// console.log("======== leak") -// }); -// -// memwatch.on('stats', function(stats) { -// console.log("======== stats") -// console.dir(stats) -// }); - -// // Take first snapshot -// var hd = new memwatch.HeapDiff(); - -MongoClient.connect('mongodb://localhost:27017/bench', function(err, db) { - var docs = []; - var total = 1000; - var count = total; - var measurements = []; - - // Insert a bunch of documents - for(var i = 0; i < 100; i++) { - docs.push(JSON.parse(data)); - } - - var col = db.collection('inserts'); - - function execute(col, callback) { - var start = new Date().getTime(); - - col.find({}).limit(100).toArray(function(e, docs) { - measurements.push(new Date().getTime() - start); - assert.equal(null, e); - callback(); - }); - } - - console.log("== insert documents") - col.insert(docs, function(e, r) { - docs = []; - assert.equal(null, e); - - console.log("== start bench") - for(var i = 0; i < total; i++) { - execute(col, function(e) { - count = count - 1; - - if(count == 0) { - // Calculate total execution time for operations - var totalTime = measurements.reduce(function(prev, curr) { - return prev + curr; - }, 0); - - console.log("==========================================="); - console.log("total time: " + totalTime) - - // var diff = hd.end(); - // console.log("==========================================="); - // console.log(JSON.stringify(diff, null, 2)) - - db.close(); - process.exit(0) - } - }); - } - }); -}); - -var data = JSON.stringify({ - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "collection_name": "test", - "database_name": "command-monitoring-tests", - "tests": [ - { - "description": "A successful mixed bulk write", - "operation": { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 4, - "x": 44 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 3 - }, - "update": { - "set": { - "x": 333 - } - } - } - } - ] - } - }, - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 4, - "x": 44 - } - ], - "ordered": true - }, - "command_name": "insert", - "database_name": "command-monitoring-tests" - } - }, - { - "command_succeeded_event": { - "reply": { - "ok": 1.0, - "n": 1 - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 3 - }, - "u": { - "set": { - "x": 333 - } - }, - "upsert": false, - "multi": false - } - ], - "ordered": true - }, - "command_name": "update", - "database_name": "command-monitoring-tests" - } - }, - { - "command_succeeded_event": { - "reply": { - "ok": 1.0, - "n": 1 - }, - "command_name": "update" - } - } - ] - }, - { - "description": "A successful unordered bulk write with an unacknowledged write concern", - "operation": { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 4, - "x": 44 - } - } - } - ], - "ordered": false, - "writeConcern": { - "w": 0 - } - } - }, - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 4, - "x": 44 - } - ], - "ordered": false, - "writeConcern": { - "w": 0 - } - }, - "command_name": "insert", - "database_name": "command-monitoring-tests" - } - }, - { - "command_succeeded_event": { - "reply": { - "ok": 1.0 - }, - "command_name": "insert" - } - } - ] - } - ] -}); diff --git a/test/smoke_plugin.js b/test/smoke_plugin.js deleted file mode 100644 index 22d0298627..0000000000 --- a/test/smoke_plugin.js +++ /dev/null @@ -1,61 +0,0 @@ -'use strict'; - -var fs = require('fs'); - -/* Note: because this plugin uses process.on('uncaughtException'), only one - * of these can exist at any given time. This plugin and anything else that - * uses process.on('uncaughtException') will conflict. */ -exports.attachToRunner = function(runner, outputFile) { - var smokeOutput = { results: [] }; - var runningTests = {}; - - var integraPlugin = { - beforeTest: function(test, callback) { - test.startTime = Date.now(); - runningTests[test.name] = test; - callback(); - }, - afterTest: function(test, callback) { - smokeOutput.results.push({ - status: test.status, - start: test.startTime, - end: Date.now(), - test_file: test.name, - exit_code: 0, - url: '' - }); - delete runningTests[test.name]; - callback(); - }, - beforeExit: function(obj, callback) { - fs.writeFile(outputFile, JSON.stringify(smokeOutput), function() { - callback(); - }); - } - }; - - // In case of exception, make sure we write file - process.on('uncaughtException', function(err) { - // Mark all currently running tests as failed - for (var testName in runningTests) { - smokeOutput.results.push({ - status: 'fail', - start: runningTests[testName].startTime, - end: Date.now(), - test_file: testName, - exit_code: 0, - url: '' - }); - } - - // write file - fs.writeFileSync(outputFile, JSON.stringify(smokeOutput)); - - // Standard NodeJS uncaught exception handler - console.error(err.stack); - process.exit(1); - }); - - runner.plugin(integraPlugin); - return integraPlugin; -};