Last active
June 29, 2017 17:19
-
-
Save misterdjules/e5c0d68ffe1f4b79d68689099ee0b7f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/models/waitlist.js b/lib/models/waitlist.js | |
index e95a860..9c1fc63 100644 | |
--- a/lib/models/waitlist.js | |
+++ b/lib/models/waitlist.js | |
@@ -1127,7 +1127,9 @@ ModelWaitlist.prototype.createTicket = function (params, callback) { | |
}; | |
var queue; | |
- self.log.info('creating ticket %s', ticket_uuid); | |
+ self.log.info({ | |
+ ticket: ticket | |
+ }, 'creating ticket %s', ticket_uuid); | |
vasync.waterfall([ | |
ensureServerQueue, | |
diff --git a/test/waitlist/test-waitlist-continuous.js b/test/waitlist/test-waitlist-continuous.js | |
index 1f2da93..ba55c67 100644 | |
--- a/test/waitlist/test-waitlist-continuous.js | |
+++ b/test/waitlist/test-waitlist-continuous.js | |
@@ -87,7 +87,7 @@ function testContinuosCreateWaitRelease(test) { | |
function create(cb) { | |
var ticketPayload = { | |
- scope: 'test1', | |
+ scope: 'test-continuous-create-wait-release', | |
id: '111', | |
expires_at: | |
(new Date((new Date().valueOf()) + 60*1000)).toISOString() | |
diff --git a/test/waitlist/test-waitlist-expiry.js b/test/waitlist/test-waitlist-expiry.js | |
index e30d7fd..7043ec1 100644 | |
--- a/test/waitlist/test-waitlist-expiry.js | |
+++ b/test/waitlist/test-waitlist-expiry.js | |
@@ -64,7 +64,7 @@ function deleteAllTickets(callback) { | |
function testExpireSingleTicket(test) { | |
var expireTimeSeconds = 3; | |
var ticketPayload = { | |
- scope: 'test', | |
+ scope: 'test-expire-single-ticket', | |
id: '123', | |
expires_at: ( | |
new Date((new Date().valueOf()) + | |
@@ -136,7 +136,7 @@ function testExpireSingleTicketStartNext(test) { | |
var expireTimeSeconds2 = 24; | |
var ticketPayload = { | |
- scope: 'test', | |
+ scope: 'test-expire-single-ticket', | |
id: '123', | |
expires_at: ( | |
new Date((new Date().valueOf()) + | |
@@ -144,7 +144,7 @@ function testExpireSingleTicketStartNext(test) { | |
}; | |
var ticketPayload2 = { | |
- scope: 'test', | |
+ scope: 'test-expire-single-ticket', | |
id: '123', | |
expires_at: ( | |
new Date((new Date().valueOf()) + | |
diff --git a/test/waitlist/test-waitlist-repeatedly.js b/test/waitlist/test-waitlist-repeatedly.js | |
index 6102553..138aaa0 100644 | |
--- a/test/waitlist/test-waitlist-repeatedly.js | |
+++ b/test/waitlist/test-waitlist-repeatedly.js | |
@@ -60,7 +60,7 @@ function deleteAllTickets(callback) { | |
function testWaitForActiveTicket(test) { | |
var ticketPayload = { | |
- scope: 'test1', | |
+ scope: 'test-waitlist-repeatedly-test-wait-for-active-ticket', | |
id: '111', | |
expires_at: (new Date((new Date().valueOf()) + 120*1000)).toISOString() | |
}; | |
@@ -119,7 +119,7 @@ function testWaitOnTicket(test) { | |
for (i = 0; i < count; i++) { | |
payloads.push({ | |
- scope: 'test1', | |
+ scope: 'test-waitlist-repeatedly-test-wait-on-ticket', | |
id: '111', | |
expires_at: | |
(new Date((new Date().valueOf()) + 120*1000)).toISOString() | |
diff --git a/test/waitlist/test-waitlist-wait.js b/test/waitlist/test-waitlist-wait.js | |
index 3a85d8e..755fb1a 100644 | |
--- a/test/waitlist/test-waitlist-wait.js | |
+++ b/test/waitlist/test-waitlist-wait.js | |
@@ -60,7 +60,7 @@ function deleteAllTickets(callback) { | |
function testWaitForActiveTicket(test) { | |
var ticketPayload = { | |
- scope: 'test1', | |
+ scope: 'test-waitlist-wait-test-wait-for-active-ticket', | |
id: '111', | |
expires_at: (new Date((new Date().valueOf()) + 120*1000)).toISOString() | |
}; | |
@@ -122,7 +122,7 @@ function testWaitOnTicket(test) { | |
for (i = 0; i < count; i++) { | |
payloads.push({ | |
- scope: 'test1', | |
+ scope: 'test-waitlist-wait-test-wait-on-ticket', | |
id: '111', | |
expires_at: | |
(new Date((new Date().valueOf()) + 120*1000)).toISOString() | |
diff --git a/test/waitlist/test-waitlist.js b/test/waitlist/test-waitlist.js | |
index 8215d19..a8e5b90 100644 | |
--- a/test/waitlist/test-waitlist.js | |
+++ b/test/waitlist/test-waitlist.js | |
@@ -11,6 +11,7 @@ | |
var Logger = require('bunyan'); | |
var restify = require('restify'); | |
+var assert = require('assert-plus'); | |
var async = require('async'); | |
var cp = require('child_process'); | |
var fs = require('fs'); | |
@@ -85,7 +86,7 @@ function testCreateTicket(test) { | |
test.expect(59); | |
var ticketPayload = { | |
- scope: 'test', | |
+ scope: 'test-create-ticket', | |
id: '123', | |
expires_at: (new Date((new Date().valueOf()) + 60*1000)).toISOString(), | |
action: 'action0', | |
@@ -93,7 +94,7 @@ function testCreateTicket(test) { | |
}; | |
var ticketPayload2 = { | |
- scope: 'test', | |
+ scope: 'test-create-ticket', | |
id: '234', | |
expires_at: (new Date((new Date().valueOf()) + 60*1000)).toISOString(), | |
action: 'action1', | |
@@ -218,7 +219,7 @@ function testCreateWaitReleaseTicket(test) { | |
var expireTimeSeconds = 3; | |
var expireTimeSeconds2 = 4; | |
var ticketPayload = { | |
- scope: 'test', | |
+ scope: 'test-create-wait-release-ticket', | |
id: '123', | |
expires_at: ( | |
new Date((new Date().valueOf()) + | |
@@ -226,7 +227,7 @@ function testCreateWaitReleaseTicket(test) { | |
}; | |
var ticketPayload2 = { | |
- scope: 'test', | |
+ scope: 'test-create-wait-release-ticket', | |
id: '123', | |
expires_at: ( | |
new Date((new Date().valueOf()) + | |
@@ -379,6 +380,7 @@ function testLimitOffsetValidation(test) { | |
// Create number of tickets given by `count` | |
function (wfcb) { | |
createTickets({ | |
+ ticketsScope: 'limit-offset-validation', | |
test: test, | |
count: count | |
}, function (err, tickets) { | |
@@ -449,6 +451,7 @@ function testFetchTicketsWithPaging(test) { | |
// Create number of tickets given by `count` | |
function (wfcb) { | |
createTickets({ | |
+ ticketsScope: 'fetch-tickets-with-paging', | |
test: test, | |
count: count | |
}, function (err, tickets) { | |
@@ -553,6 +556,7 @@ function testDeleteOver1000Tickets(test) { | |
async.waterfall([ | |
function (wfcb) { | |
createTickets({ | |
+ ticketsScope: 'delete-over-1000-tickets', | |
test: test, | |
count: count | |
}, function (err, tickets) { | |
@@ -589,14 +593,17 @@ function testDeleteOver1000Tickets(test) { | |
function getcb(err, req, res, results) { | |
test.ok(Array.isArray(results), 'result is an array'); | |
test.equal(results.length, 0, | |
- 'result length is 0 (was ' + | |
- results.length + ')'); | |
+ 'result length is 0 (was ' + | |
+ results.length + ', content: ' + | |
+ util.inspect(results) + ')'); | |
wfcb(); | |
} | |
} | |
], function (err) { | |
+ console.log((new Date().toISOString() + 'calling test.done()')); | |
test.done(); | |
+ console.log((new Date().toISOString() + 'called test.done()')); | |
}); | |
} | |
@@ -608,6 +615,11 @@ function testDeleteOver1000Tickets(test) { | |
*/ | |
function createTickets(opts, callback) { | |
+ assert.object(opts, 'opts'); | |
+ assert.number(opts.count, 'opts.count'); | |
+ assert.string(opts.ticketsScope, 'opts.ticketsScope'); | |
+ assert.object(opts.test, 'opts.test'); | |
+ | |
var ticketUuids = {}; | |
var count = opts.count; | |
@@ -623,7 +635,11 @@ function createTickets(opts, callback) { | |
var payloads = []; | |
for (i = 0; i < count; i++) { | |
payloads.push({ | |
- scope: 'test1', | |
+ scope: opts.ticketsScope, | |
+ /* | |
+ * This ID needs to be constant so tickets get queued and | |
+ * don't become active. | |
+ */ | |
id: '111', | |
expires_at: | |
(new Date((new Date().valueOf()) + |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment