· 6 years ago · Jun 07, 2019, 03:04 PM
1➜ fxa-auth-db-mysql git:(farhan-gsoc) ✗ npm test
2
3> fxa-auth-db-mysql@1.137.4 test /Users/farhan/Desktop/contri/mozilla/fxa/packages/fxa-auth-db-mysql
4> npm run test-mysql && npm run test-mem && npm run test-server && grunt eslint
5
6
7> fxa-auth-db-mysql@1.137.4 test-mysql /Users/farhan/Desktop/contri/mozilla/fxa/packages/fxa-auth-db-mysql
8> node ./bin/db_patcher.js >/dev/null && ./scripts/mocha-coverage.js test/backend test/local --exit
9
10
11
12 db_tests
13 db.securityEvents
14 ✓ should get security event
15 ✓ should get event after session verified
16 ✓ should get second address
17 ✓ should get second addr after deleting unverified session
18 ✓ should get with IPv6
19 ✓ should fail with unknown uid
20 ✓ should delete events when account is deleted
21 db.securityEventsByUid
22 ✓ should get security event
23 ✓ should get security event for another account
24 ✓ should get event after session verified
25 ✓ should give no securityEvent with new unknown uid
26 ✓ should delete events when account is deleted
27 account subscriptions
28 ✓ should create a new subscription for account
29 ✓ should fail to create for unknown account
30 ✓ should fail to create duplicate subscription id on the same account
31 ✓ should fail to create duplicate subscription id across accounts
32 ✓ should support fetching all subscriptions
33 ✓ should support deleting a subscription
34 ✓ should not throw an error when subscription deletion is attempted for a non-existent subscription
35 ✓ should not throw an error when subscription deletion is attempted twice
36 ✓ should cancel subscriptions
37 ✓ should fail to cancel a non-existent subscription
38 ✓ should fail to cancel a cancelled subscription
39 ✓ should support fetching one subscription
40 ✓ should fail to fetch a subscription that does not exist
41 ✓ should fail to fetch an existing subscription for the wrong user
42
43 remote
44 ✓ heartbeat (64ms)
45 ✓ version
46 ✓ version
47 ✓ account not found
48 ✓ add account, add email, get secondary email, get emails, delete email (89ms)
49 ✓ add account, check password, retrieve it, delete it (56ms)
50 ✓ session token handling (138ms)
51 ✓ device handling (141ms)
52 ✓ key fetch token handling (94ms)
53 ✓ account reset token handling (40ms)
54 ✓ password change token handling
55 ✓ password forgot token handling (45ms)
56 ✓ password forgot token verified (40ms)
57 ✓ locale
58 ✓ unblock codes
59 ✓ email bounces
60 ✓ sign-in codes (50ms)
61 ✓ GET an unknown path
62 ✓ PUT an unknown path
63 ✓ POST an unknown path
64 ✓ DELETE an unknown path
65 ✓ HEAD an unknown path
66 ✓ rejection of invalid hex data
67 reset account tokens
68 ✓ should remove password forgot token
69 ✓ should remove password change token
70 ✓ should remove account reset token (40ms)
71 add account, add email, change email
72 ✓ should change email
73 add account, verify session and keyfetch with tokenVerificationCode
74 ✓ should verify session and keyfetch with tokenVerificationCode (42ms)
75 totp tokens
76 ✓ should get totp token
77 ✓ should delete totp token
78 ✓ should update totp token
79 should set session verification method
80 ✓ set session verification method - totp-2fa
81 ✓ set session verification method - recovery-code
82 recovery codes
83 ✓ should generate new recovery codes (1451ms)
84 ✓ should fail to consume unknown recovery code
85 ✓ should consume recovery code (2524ms)
86 recovery key
87 ✓ should create a recovery key
88 ✓ should get a recovery key
89 ✓ should delete a recovery key
90 ✓ should check if recovery key exists
91 account subscriptions
92 ✓ should create a new subscription
93 ✓ should get one subscription
94 ✓ should list subscriptions (39ms)
95 ✓ should support deleting a subscription
96
97 constants
98 ✓ constants exports DATABASE_NAME fxa
99
100 DB patch
101 ✓ should error with incorrect patchVersion
102
103 DB statInterval
104 ✓ should log stats periodically (98ms)
105
106 DB metrics
107 ✓ queries, with no mocking (150ms)
108 ✓ run, with mocked queries (74ms)
109
110 MySQL
111 ✓ validates REQUIRED_CHARSET for connections
112 ✓ accepts REQUIRED_SQL_MODES from config
113 ✓ rejects unrecognized REQUIRED_SQL_MODES values from config
114 ✓ rejects badly-formed REQUIRED_SQL_MODES from config, for safety
115 ✓ a select on an unknown table should result in an error
116 ✓ an update to an unknown table should result in an error
117 ✓ an transaction to update an unknown table should result in an error
118 ✓ retryable does retry when the errno is matched
119 ✓ check that an error in a stored procedure (with transaction) is propagated back
120 ✓ readMultiple with valid queries
121 ✓ readMultiple with final query
122 ✓ readMultiple with error in query
123 ✓ readMultiple with error in final query
124 ✓ _connectionConfig returns a plausible config object
125 ✓ _showVariables returns a plausible set of values
126 ✓ create account and read email record
127 ✓ writes and reads non-BMP characters (41ms)
128 ✓ assertPatchLevel fails with an invalid patch level
129 ✓ assertPatchLevel succeeds with an valid patch level
130
131 prune tokens
132 ✓ prune tokens (114ms)
133
134 random
135 ✓ should generate random code
136
137 utils
138 ✓ createHashScrypt (361ms)
139 compareHashScrypt
140 ✓ should fail for different input (630ms)
141 ✓ should succeed for same input (281ms)
142 generateRecoveryCodes
143 ✓ should generate correct count of codes
144 ✓ should generate correct length of code
145 ✓ should generate code in keyspace
146 aggregateNameValuePairs
147 ✓ should correctly handle an empty result set
148 ✓ should aggregate based on id
149 ✓ should allow custom column names
150 ✓ should aggregate NULL name/value pairs as an empty object
151 ✓ should copy across additional columns unaggregated
152 ✓ should correct handle null ids from outer joins
153
154
155 108 passing (9s)
156
157------------------------|----------|----------|----------|----------|-------------------|
158File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
159------------------------|----------|----------|----------|----------|-------------------|
160All files | 68.68 | 24.68 | 72.17 | 68.49 | |
161 bin | 54.05 | 32 | 58.33 | 54.05 | |
162 metrics.js | 54.05 | 32 | 58.33 | 54.05 |... 76,179,184,188 |
163 config | 100 | 100 | 100 | 100 | |
164 config.js | 100 | 100 | 100 | 100 | |
165 index.js | 100 | 100 | 100 | 100 | |
166 db-server | 97.14 | 68.75 | 92.68 | 97.1 | |
167 index.js | 97.14 | 68.75 | 92.68 | 97.1 | 132,273,325,351 |
168 db-server/lib | 88.57 | 79.17 | 61.11 | 87.5 | |
169 bufferize.js | 100 | 83.33 | 100 | 100 | 20,41,44 |
170 error.js | 75.76 | 75 | 41.67 | 75 |... ,87,96,107,120 |
171 safeJsonFormatter.js | 100 | 50 | 100 | 100 | 6 |
172 db-server/test | 100 | 100 | 100 | 100 | |
173 client-then.js | 100 | 100 | 100 | 100 | |
174 fake.js | 100 | 100 | 100 | 100 | |
175 db-server/test/backend | 94.23 | 0 | 88.86 | 94.13 | |
176 db_tests.js | 87.68 | 0 | 87.36 | 87.27 |... 2857,2872,2885 |
177 index.js | 100 | 100 | 100 | 100 | |
178 remote.js | 96.19 | 100 | 89.26 | 96.15 |... 1502,1516,1531 |
179 lib | 100 | 100 | 100 | 100 | |
180 constants.js | 100 | 100 | 100 | 100 | |
181 logging.js | 100 | 100 | 100 | 100 | |
182 promise.js | 100 | 100 | 100 | 100 | |
183 lib/db | 42.4 | 20.78 | 51.93 | 42.39 | |
184 mem.js | 3.55 | 0 | 0 | 3.58 |... 1625,1626,1629 |
185 mysql.js | 87.77 | 60 | 90.69 | 87.99 |... 1586,1594,1606 |
186 patch.js | 100 | 100 | 100 | 100 | |
187 random.js | 100 | 100 | 100 | 100 | |
188 util.js | 94.74 | 73.68 | 100 | 94.64 | 67,75,83 |
189------------------------|----------|----------|----------|----------|-------------------|
190
191> fxa-auth-db-mysql@1.137.4 test-mem /Users/farhan/Desktop/contri/mozilla/fxa/packages/fxa-auth-db-mysql
192> ./scripts/mocha-coverage.js test/mem --exit
193
194
195
196 db_tests
197 db.securityEvents
198 ✓ should get security event
199 ✓ should get event after session verified
200 ✓ should get second address
201 ✓ should get second addr after deleting unverified session
202 ✓ should get with IPv6
203 ✓ should fail with unknown uid
204 ✓ should delete events when account is deleted
205 db.securityEventsByUid
206 1) should get security event
207 2) should get security event for another account
208 3) should get event after session verified
209 4) should give no securityEvent with new unknown uid
210 5) should delete events when account is deleted
211 account subscriptions
212 ✓ should create a new subscription for account
213 ✓ should fail to create for unknown account
214 ✓ should fail to create duplicate subscription id on the same account
215 ✓ should fail to create duplicate subscription id across accounts
216 ✓ should support fetching all subscriptions
217 ✓ should support deleting a subscription
218 ✓ should not throw an error when subscription deletion is attempted for a non-existent subscription
219 ✓ should not throw an error when subscription deletion is attempted twice
220 ✓ should cancel subscriptions
221 ✓ should fail to cancel a non-existent subscription
222 ✓ should fail to cancel a cancelled subscription
223 ✓ should support fetching one subscription
224 ✓ should fail to fetch a subscription that does not exist
225 ✓ should fail to fetch an existing subscription for the wrong user
226
227 remote
228 ✓ heartbeat
229 ✓ version
230 ✓ version
231 ✓ account not found
232 ✓ add account, add email, get secondary email, get emails, delete email (48ms)
233 ✓ add account, check password, retrieve it, delete it (45ms)
234 ✓ session token handling (87ms)
235 ✓ device handling (85ms)
236 ✓ key fetch token handling (76ms)
237 ✓ account reset token handling
238 ✓ password change token handling
239 ✓ password forgot token handling (42ms)
240 ✓ password forgot token verified
241 ✓ locale
242 ✓ unblock codes
243 ✓ email bounces
244 ✓ sign-in codes
245 ✓ GET an unknown path
246 ✓ PUT an unknown path
247 ✓ POST an unknown path
248 ✓ DELETE an unknown path
249 ✓ HEAD an unknown path
250 ✓ rejection of invalid hex data
251 reset account tokens
252 ✓ should remove password forgot token
253 ✓ should remove password change token
254 ✓ should remove account reset token
255 add account, add email, change email
256 ✓ should change email
257 add account, verify session and keyfetch with tokenVerificationCode
258 ✓ should verify session and keyfetch with tokenVerificationCode
259 totp tokens
260 ✓ should get totp token
261 ✓ should delete totp token
262 ✓ should update totp token
263 should set session verification method
264 ✓ set session verification method - totp-2fa
265 ✓ set session verification method - recovery-code
266 recovery codes
267 ✓ should generate new recovery codes (1250ms)
268 ✓ should fail to consume unknown recovery code
269 ✓ should consume recovery code (2378ms)
270 recovery key
271 ✓ should create a recovery key
272 ✓ should get a recovery key
273 ✓ should delete a recovery key
274 ✓ should check if recovery key exists
275 account subscriptions
276 ✓ should create a new subscription
277 ✓ should get one subscription
278 ✓ should list subscriptions
279 ✓ should support deleting a subscription
280
281
282 65 passing (5s)
283 5 failing
284
285 1) db_tests
286 db.securityEventsByUid
287 should get security event:
288 TypeError: Cannot read property 'd6eda1a804c88719c7931abfa4095e6a' of undefined
289 at Memory.securityEventsByUid (lib/db/mem.js:49:4357)
290 at Context.it (db-server/test/backend/db_tests.js:1064:585)
291 at tryCatcher (node_modules/bluebird/js/release/util.js:16:23)
292 at Promise._settlePromiseFromHandler (node_modules/bluebird/js/release/promise.js:512:31)
293 at Promise._settlePromise (node_modules/bluebird/js/release/promise.js:569:18)
294 at Promise._settlePromise0 (node_modules/bluebird/js/release/promise.js:614:10)
295 at Promise._settlePromises (node_modules/bluebird/js/release/promise.js:694:18)
296 at Promise._fulfill (node_modules/bluebird/js/release/promise.js:638:18)
297 at Promise._resolveCallback (node_modules/bluebird/js/release/promise.js:432:57)
298 at Promise._settlePromiseFromHandler (node_modules/bluebird/js/release/promise.js:524:17)
299 at Promise._settlePromise (node_modules/bluebird/js/release/promise.js:569:18)
300 at Promise._settlePromise0 (node_modules/bluebird/js/release/promise.js:614:10)
301 at Promise._settlePromises (node_modules/bluebird/js/release/promise.js:694:18)
302 at Promise._fulfill (node_modules/bluebird/js/release/promise.js:638:18)
303 at Timeout._onTimeout (node_modules/bluebird/js/release/timers.js:26:46)
304
305 2) db_tests
306 db.securityEventsByUid
307 should get security event for another account:
308 TypeError: Cannot read property 'bfc9b160ccc5af6f55a1cefbd1df3bc2' of undefined
309 at Memory.securityEventsByUid (lib/db/mem.js:49:4357)
310 at Context.it (db-server/test/backend/db_tests.js:1065:932)
311 at tryCatcher (node_modules/bluebird/js/release/util.js:16:23)
312 at Promise._settlePromiseFromHandler (node_modules/bluebird/js/release/promise.js:512:31)
313 at Promise._settlePromise (node_modules/bluebird/js/release/promise.js:569:18)
314 at Promise._settlePromise0 (node_modules/bluebird/js/release/promise.js:614:10)
315 at Promise._settlePromises (node_modules/bluebird/js/release/promise.js:694:18)
316 at Promise._fulfill (node_modules/bluebird/js/release/promise.js:638:18)
317 at Promise._resolveCallback (node_modules/bluebird/js/release/promise.js:432:57)
318 at Promise._settlePromiseFromHandler (node_modules/bluebird/js/release/promise.js:524:17)
319 at Promise._settlePromise (node_modules/bluebird/js/release/promise.js:569:18)
320 at Promise._settlePromise0 (node_modules/bluebird/js/release/promise.js:614:10)
321 at Promise._settlePromises (node_modules/bluebird/js/release/promise.js:694:18)
322 at Promise._fulfill (node_modules/bluebird/js/release/promise.js:638:18)
323 at Timeout._onTimeout (node_modules/bluebird/js/release/timers.js:26:46)
324
325 3) db_tests
326 db.securityEventsByUid
327 should get event after session verified:
328 TypeError: Cannot read property 'a8ab41f0d58616878b98736533d1ab24' of undefined
329 at Memory.securityEventsByUid (lib/db/mem.js:49:4357)
330 at db.verifyTokens.then (db-server/test/backend/db_tests.js:1065:1552)
331 at tryCatcher (node_modules/bluebird/js/release/util.js:16:23)
332 at Promise._settlePromiseFromHandler (node_modules/bluebird/js/release/promise.js:512:31)
333 at Promise._settlePromise (node_modules/bluebird/js/release/promise.js:569:18)
334 at Promise._settlePromiseCtx (node_modules/bluebird/js/release/promise.js:606:10)
335 at _drainQueueStep (node_modules/bluebird/js/release/async.js:142:12)
336 at _drainQueue (node_modules/bluebird/js/release/async.js:131:9)
337 at Async._drainQueues (node_modules/bluebird/js/release/async.js:147:5)
338 at Immediate.Async.drainQueues [as _onImmediate] (node_modules/bluebird/js/release/async.js:17:14)
339 at process.topLevelDomainCallback (domain.js:120:23)
340
341 4) db_tests
342 db.securityEventsByUid
343 should give no securityEvent with new unknown uid:
344 TypeError: Cannot read property '5d85d9632595e4ae4d3eb1a910262b32' of undefined
345 at Memory.securityEventsByUid (lib/db/mem.js:49:4357)
346 at Context.it (db-server/test/backend/db_tests.js:1065:2052)
347 at tryCatcher (node_modules/bluebird/js/release/util.js:16:23)
348 at Promise._settlePromiseFromHandler (node_modules/bluebird/js/release/promise.js:512:31)
349 at Promise._settlePromise (node_modules/bluebird/js/release/promise.js:569:18)
350 at Promise._settlePromise0 (node_modules/bluebird/js/release/promise.js:614:10)
351 at Promise._settlePromises (node_modules/bluebird/js/release/promise.js:694:18)
352 at Promise._fulfill (node_modules/bluebird/js/release/promise.js:638:18)
353 at Promise._resolveCallback (node_modules/bluebird/js/release/promise.js:432:57)
354 at Promise._settlePromiseFromHandler (node_modules/bluebird/js/release/promise.js:524:17)
355 at Promise._settlePromise (node_modules/bluebird/js/release/promise.js:569:18)
356 at Promise._settlePromise0 (node_modules/bluebird/js/release/promise.js:614:10)
357 at Promise._settlePromises (node_modules/bluebird/js/release/promise.js:694:18)
358 at Promise._fulfill (node_modules/bluebird/js/release/promise.js:638:18)
359 at Timeout._onTimeout (node_modules/bluebird/js/release/timers.js:26:46)
360
361 5) db_tests
362 db.securityEventsByUid
363 should delete events when account is deleted:
364 TypeError: Cannot read property '347fcd79d35cc8e9895ef7e858737e46' of undefined
365 at Memory.securityEventsByUid (lib/db/mem.js:49:4357)
366 at db.deleteAccount.then (db-server/test/backend/db_tests.js:1065:2420)
367 at tryCatcher (node_modules/bluebird/js/release/util.js:16:23)
368 at Promise._settlePromiseFromHandler (node_modules/bluebird/js/release/promise.js:512:31)
369 at Promise._settlePromise (node_modules/bluebird/js/release/promise.js:569:18)
370 at Promise._settlePromise0 (node_modules/bluebird/js/release/promise.js:614:10)
371 at Promise._settlePromises (node_modules/bluebird/js/release/promise.js:694:18)
372 at _drainQueueStep (node_modules/bluebird/js/release/async.js:138:12)
373 at _drainQueue (node_modules/bluebird/js/release/async.js:131:9)
374 at Async._drainQueues (node_modules/bluebird/js/release/async.js:147:5)
375 at Immediate.Async.drainQueues [as _onImmediate] (node_modules/bluebird/js/release/async.js:17:14)
376 at process.topLevelDomainCallback (domain.js:120:23)
377
378
379
380------------------------|----------|----------|----------|----------|-------------------|
381File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
382------------------------|----------|----------|----------|----------|-------------------|
383All files | 71.88 | 51.1 | 66.78 | 71.74 | |
384 config | 100 | 100 | 100 | 100 | |
385 config.js | 100 | 100 | 100 | 100 | |
386 index.js | 100 | 100 | 100 | 100 | |
387 db-server | 97.14 | 62.5 | 92.68 | 97.1 | |
388 index.js | 97.14 | 62.5 | 92.68 | 97.1 | 132,273,325,351 |
389 db-server/lib | 84.29 | 70.83 | 55.56 | 84.38 | |
390 bufferize.js | 100 | 83.33 | 100 | 100 | 20,41,44 |
391 error.js | 66.67 | 25 | 33.33 | 68.75 |... 07,119,120,122 |
392 safeJsonFormatter.js | 100 | 50 | 100 | 100 | 6 |
393 db-server/test | 73.24 | 100 | 70.59 | 72.86 | |
394 client-then.js | 100 | 100 | 100 | 100 | |
395 fake.js | 64.15 | 100 | 61.54 | 64.15 |... 03,210,211,219 |
396 db-server/test/backend | 92.56 | 0 | 87.65 | 92.43 | |
397 db_tests.js | 80.43 | 0 | 81.61 | 79.78 |... 2857,2872,2885 |
398 index.js | 100 | 100 | 100 | 100 | |
399 remote.js | 96.19 | 100 | 89.26 | 96.15 |... 1502,1516,1531 |
400 lib | 100 | 100 | 100 | 100 | |
401 constants.js | 100 | 100 | 100 | 100 | |
402 promise.js | 100 | 100 | 100 | 100 | |
403 lib/db | 51.48 | 50.65 | 42.16 | 51.49 | |
404 mem.js | 85.55 | 71.75 | 89.29 | 85.57 |... 1512,1515,1537 |
405 mysql.js | 3.52 | 0 | 0 | 3.55 |... 1661,1664,1667 |
406 patch.js | 100 | 100 | 100 | 100 | |
407 random.js | 100 | 100 | 100 | 100 | |
408 util.js | 73.68 | 36.84 | 80 | 73.21 |... 99,201,202,204 |
409------------------------|----------|----------|----------|----------|-------------------|
410npm ERR! code ELIFECYCLE
411npm ERR! errno 5
412npm ERR! fxa-auth-db-mysql@1.137.4 test-mem: `./scripts/mocha-coverage.js test/mem --exit`
413npm ERR! Exit status 5
414npm ERR!
415npm ERR! Failed at the fxa-auth-db-mysql@1.137.4 test-mem script.
416npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
417
418npm ERR! A complete log of this run can be found in:
419npm ERR! /Users/farhan/.npm/_logs/2019-06-07T14_59_34_610Z-debug.log
420npm ERR! Test failed. See above for more details.
421➜ fxa-auth-db-mysql git:(farhan-gsoc) ✗