From cde27357ae84cb215356c1bc4b465bcc5c7d64dc Mon Sep 17 00:00:00 2001 From: PBR Date: Wed, 24 Jul 2013 00:18:13 +0200 Subject: [PATCH 1/4] correct machineHash --- lib/objectid.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/objectid.js b/lib/objectid.js index 9d3953b..cd94b2c 100644 --- a/lib/objectid.js +++ b/lib/objectid.js @@ -11,7 +11,7 @@ module.exports = ObjectId // from docs: This is the first three bytes of the (md5) hash of the machine host name, or of the mac/network address, // or the virtual machine id. -var machineHash = crypto.createHash('md5').update(os.hostname()).digest('binary') +var machineHash = crypto.createHash('md5').update(os.hostname()).digest() // Pre-cache the machine hash / pid var machineAndPid = [ @@ -92,4 +92,4 @@ try { } return buffer } -} \ No newline at end of file +} From 091bd2224c34f5e94e77ad631bced61c41ba9bc2 Mon Sep 17 00:00:00 2001 From: PBR Date: Fri, 2 Aug 2013 04:47:40 +0200 Subject: [PATCH 2/4] test for machine id correction --- package.json | 4 ++-- test/objectid.js | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 test/objectid.js diff --git a/package.json b/package.json index 9126371..34bdb4d 100644 --- a/package.json +++ b/package.json @@ -14,9 +14,9 @@ "nodeunit": "0.6.4" }, "scripts": { - "test": "node_modules/.bin/nodeunit test/bson-test.js test/mongo-test.js" + "test": "node_modules/.bin/nodeunit test/bson-test.js test/mongo-test.js test/objectid.js" }, "engines": { "node": ">=0.4.0" } -} \ No newline at end of file +} diff --git a/test/objectid.js b/test/objectid.js new file mode 100644 index 0000000..fa75289 --- /dev/null +++ b/test/objectid.js @@ -0,0 +1,13 @@ +var BSON = require('../buffalo') + +module.exports = { + "machine id part of ObjectID is not zero": function(test) { + var objid = new BSON.ObjectId(); + console.log(objid); + console.log([objid.bytes[4], objid.bytes[5], objid.bytes[6]]); + test.ok(!(objid.bytes[4] == 0x00 && + objid.bytes[5] == 0x00 && + objid.bytes[6] == 0x00)) + test.done() + }, +} From 15c676a853fd3ddc64d81d1a0abd99dba4105b3c Mon Sep 17 00:00:00 2001 From: PBR Date: Fri, 2 Aug 2013 04:50:27 +0200 Subject: [PATCH 3/4] remove debug output --- test/objectid.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/objectid.js b/test/objectid.js index fa75289..1a32c06 100644 --- a/test/objectid.js +++ b/test/objectid.js @@ -3,8 +3,6 @@ var BSON = require('../buffalo') module.exports = { "machine id part of ObjectID is not zero": function(test) { var objid = new BSON.ObjectId(); - console.log(objid); - console.log([objid.bytes[4], objid.bytes[5], objid.bytes[6]]); test.ok(!(objid.bytes[4] == 0x00 && objid.bytes[5] == 0x00 && objid.bytes[6] == 0x00)) From 10caef37cf743f4aaa7ef6ccef5d99c621570f6e Mon Sep 17 00:00:00 2001 From: PBR Date: Fri, 2 Aug 2013 05:02:55 +0200 Subject: [PATCH 4/4] adding newer node.js versions to travis-ci config file --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 381c985..63f16d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,6 @@ language: node_js node_js: + - 0.10 + - 0.8 + - 0.6 - 0.4 - - 0.6 \ No newline at end of file