Permalink
Browse files

Added test certificate, added manual test

  • Loading branch information...
1 parent 3081c57 commit f5e84a027cd3ba6387a09e74b1ec49d09a082a58 @christkv christkv committed Dec 2, 2011
Showing with 119 additions and 0 deletions.
  1. +36 −0 test/certificates/mycert.pem
  2. +83 −0 test/manual_tests/test.js
@@ -0,0 +1,36 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: DES-EDE3-CBC,5BC1D8935109F6C8
+
+cbr7PTUV8ySzjBsvtCLng+0m7aez0D/Q76JnsW265oLxwqqID9mgS3rIZUgbu2SQ
++rfTTG+xcrONJs41Pbao1D1BNcUrmLF+8pl6055xFOPWrE1cxHQRShlhgG/pLVE3
+JqLFLV4Pd8Tf+o3FwbZ3zqgqwMPVZN/TLfzw94qcrXiidNvWuWf3oyU4w+CzD4Vt
+f9HYNOeZWCUtaGGM5koUU/qu/RYQdKXZTRPz9wCHTjSsrznE4BpAJgtBbaOpr850
+c3WP48aveK9NZ9aoR1c+BW6MN+HPN2HhwA9rQUBSwfwlVVxxY1Ir2ArbP7fStlvK
+TRtuE7Ro0ZEOUiHB5c9X7p6clKgshP7K19ZG6O0ns1P9d9z7l35f1WG/XQxA66tg
+h8haN8nOtPJfrAyn5NcmOS2kTA0kL6Lk2TWwqoVErvpCRgdyhQ94GxjMiHLvkfxx
+z5fVQqoXuYV8O6ozfdx+58qJnRTLC1cHf8iwWc9sDE/IP9OTpxwMUBKX4EYOL8MQ
+4pjv0qnD/PQN4B5CbQ0RViBLykl22SScxqS3Zq14/sItEjM44ctjgAfmoPZSElTz
+n9zhc8VQzgyjuNRt02xAi+tx2RD5I44ylm7QTYnXdWVgftnSgY+Ir4npTK5bnxIB
+b9CLPljXbj8k5utoTyFkZa+bRES3a3+MEq5dNFRb0neQ3nJXqB83hMEDE35XWbU0
+gJwG7KsVS6Vr3SfBi47fsoIH1Ii92hZxWrtbTlzjy884zSps+mTWGA6TuU8jb6jn
+b2JyNJDhVqDk19DPP+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KUwvvtf/h
+7rUWJPi+evtVGTxRhCQGJcoI9lEK
+-----END CERTIFICATE-----
@@ -0,0 +1,83 @@
+var mongodb = require("./lib/mongodb"),
+ ReplicaSetManager = require('./test/tools/replica_set_manager').ReplicaSetManager;
+
+var options = {
+ auto_reconnect: true,
+ poolSize: 4,
+ socketOptions: { keepAlive: 100, timeout:30000 }
+};
+
+var userObjects = [];
+
+// Build user array
+for(var i = 0; i < 122; i++) {
+ userObjects.push({'user_id':i});
+}
+
+// var replSet = new mongodb.ReplSetServers([
+// new mongodb.Server("mongo-1", 27017, options),
+// new mongodb.Server("mongo-2", 27017, options),
+// new mongodb.Server("mongo-3", 27017, options)
+// ]);
+
+RS = new ReplicaSetManager({retries:120, secondary_count:2, passive_count:1, arbiter_count:1});
+RS.startSet(true, function(err, result) {
+ // Replica configuration
+ var replSet = new mongodb.ReplSetServers( [
+ new mongodb.Server( RS.host, RS.ports[1], { auto_reconnect: true } ),
+ new mongodb.Server( RS.host, RS.ports[0], { auto_reconnect: true } ),
+ new mongodb.Server( RS.host, RS.ports[2], { auto_reconnect: true } )
+ ],
+ {rs_name:RS.name}
+ // {rs_name:RS.name, strategy:'ping'}
+ // {rs_name:RS.name, strategy:'statistical'}
+ );
+
+ var users;
+ var db = new mongodb.Db("data", replSet);
+ db.open(function(err, client){
+ if(err){
+ console.log("[%s] %s", new Date, err.stack || err);
+ return;
+ }
+
+ if(users){
+ console.log("[%s] Reconnected?!", new Date);
+ return;
+ }
+
+ client.collection("users", function(err, coll){
+ console.log("Connected");
+ coll.insert(userObjects, {safe:true}, function(err, result) {
+ users = coll;
+ query();
+ })
+ });
+ // client.collection("users", function(err, users){
+ // console.log("Connected");
+ // db.users = users;
+ // query();
+ // });
+ });
+
+ function query(){
+ console.log("[%s] querying all users", new Date);
+ // setTimeout(query, 70 * 60 * 1000);
+ setTimeout(query, 32 * 1000);
+ db.collection('users', function(err, coll) {
+ if(err){
+ console.log("[0] :: [%s] %s", new Date, err.stack || err);
+ }
+
+ coll.find().count(function(err, all){
+ if(err){
+ console.log("[1] :: [%s] %s", new Date, err.stack || err);
+ }else{
+ console.log("[2] :: [%s] found %s users", new Date, all);
+ }
+ });
+ })
+ }
+});
+
+

0 comments on commit f5e84a0

Please sign in to comment.