mozilla / fxa-auth-server

DEPRECATED - Migrated to https://github.com/mozilla/fxa
Mozilla Public License 2.0
399 stars 108 forks source link

Local email tests have failing assertions that don't fail the test run #2882

Closed philbooth closed 5 years ago

philbooth commented 5 years ago
Error: expected false to be truthy
    at Nodemailer.mailer.mailer.sendMail (/Users/philbooth/code/fxa-local-dev/fxa-auth-server/test/local/senders/email.js:514:22)
    at P.all.services.map.service (/Users/philbooth/code/fxa-local-dev/fxa-auth-server/lib/senders/email.js:338:18)
    at Array.map (<anonymous>)
    at selectEmailServices.then.services (/Users/philbooth/code/fxa-local-dev/fxa-auth-server/lib/senders/email.js:282:31)
    at tryCatcher (/Users/philbooth/code/fxa-local-dev/fxa-auth-server/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/philbooth/code/fxa-local-dev/fxa-auth-server/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/Users/philbooth/code/fxa-local-dev/fxa-auth-server/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/Users/philbooth/code/fxa-local-dev/fxa-auth-server/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/Users/philbooth/code/fxa-local-dev/fxa-auth-server/node_modules/bluebird/js/release/promise.js:694:18)
    at _drainQueueStep (/Users/philbooth/code/fxa-local-dev/fxa-auth-server/node_modules/bluebird/js/release/async.js:138:12)
    at _drainQueue (/Users/philbooth/code/fxa-local-dev/fxa-auth-server/node_modules/bluebird/js/release/async.js:131:9)
    at Async._drainQueues (/Users/philbooth/code/fxa-local-dev/fxa-auth-server/node_modules/bluebird/js/release/async.js:147:5)
    at Immediate.Async.drainQueues (/Users/philbooth/code/fxa-local-dev/fxa-auth-server/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
philbooth commented 5 years ago

This is the failing assertion:

assert.ok(includes(emailConfig.html, accountSettingsUrl))

This is the value of accountSettingsUrl:

http://127.0.0.1:3030/settings?email=a%40b.com&uid=uid&utm_medium=email&utm_campaign=fx-new-device-signin&utm_content=fx-manage-account

And this is the actual href in the rendered email body:

http://127.0.0.1:3030/settings?utm_medium=email&utm_campaign=fx-new-device-signin&utm_content=fx-manage-account

So as you can see, it is the email and uid query params that cause it to fail.

I see two fixes here:

  1. Fix the failing assertion.
  2. Ensure that all of the local email tests return their promise so that the test runner knows about failed assertions.
philbooth commented 5 years ago

Fwiw, git bisect says it went wrong in 7d4649bc97ea71e660bec3ca49f21cb5a40f4ac0, which comes from #2747 / #2766.