From 591a1b1246f4cc0dd62f641c58b05160863edf0a Mon Sep 17 00:00:00 2001 From: Lloyd Hilaiel <lloyd@hilaiel.com> Date: Thu, 17 Nov 2011 22:05:46 -0700 Subject: [PATCH] (loadgen) now starts up, generates 30 keypairs, adds 30 users - simulated signup mostly updated to new apis - issue #504 --- bin/load_gen | 2 +- lib/load_gen/signup.js | 10 +++++----- lib/load_gen/user_db.js | 8 ++++++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/bin/load_gen b/bin/load_gen index 26032661e..599efb8f1 100755 --- a/bin/load_gen +++ b/bin/load_gen @@ -281,7 +281,7 @@ function poll() { } // always start out by creating a bunch of users -var NUM_INITIAL_USERS = 1; +var NUM_INITIAL_USERS = 30; // if an explicit target was specified, let's output what that means // in understandable terms diff --git a/lib/load_gen/signup.js b/lib/load_gen/signup.js index 6dd123e40..c50897625 100644 --- a/lib/load_gen/signup.js +++ b/lib/load_gen/signup.js @@ -113,11 +113,11 @@ exports.startFunc = function(cfg, cb) { // process wcli.post(cfg, '/wsapi/cert_key', context, { email: email, - pubkey: keypair.publicKey.toSimpleObject() - }, function(r) { - var rv = (r.code === 200 && r.body === '"complete"'); - if (!rv) winston.error("registration_status failed during signup: " + JSON.stringify(r)); - cb(rv); + pubkey: keypair.publicKey.serialize() + }, function(resp) { + if (typeof resp.body !== 'string') return cb(false); + userdb.addCertToUserCtx(context, email, resp.body); + cb(true); }); }); }); diff --git a/lib/load_gen/user_db.js b/lib/load_gen/user_db.js index 6b97f3902..b7c09ce17 100644 --- a/lib/load_gen/user_db.js +++ b/lib/load_gen/user_db.js @@ -129,6 +129,10 @@ exports.addKeyToUserCtx = function(ctx, email) { // the verifier, but that in turn will drastically increase the // cost of the application of load. ho hum. var k = exports.any(keys.keyPairs); - ctx.keys[email] = k; + ctx.keys[email] = { keyPair: k }; return k; -} +}; + +exports.addCertToUserCtx = function(ctx, email, cert) { + ctx.keys[email].cert = cert; +}; -- GitLab