Permalink
Browse files

Bug 975298 - [email/backend] intermittent GELAM test failure for POP3…

… in test_account_bad_password_error
  • Loading branch information...
asutherland committed Feb 21, 2014
1 parent 9965840 commit 82a3fd49e6a18285d004a5dec05aa58c48ae4ef7
@@ -439,6 +439,7 @@ exports.LOGFAB_DEFINITION = {
opError: { mode: false, type: false, ex: log.EXCEPTION },
},
asyncJobs: {
+ checkAccount: { err: null },
runOp: { mode: true, type: true, error: false, op: false },
},
TEST_ONLY_asyncJobs: {
@@ -709,7 +709,11 @@ var properties = {
},
checkAccount: function(listener) {
- this._makeConnection(listener, null, 'check');
+ this._LOG.checkAccount_begin(null);
+ this._makeConnection(function(err) {
+ this._LOG.checkAccount_end(err);
+ listener(err);
+ }.bind(this), null, 'check');
},
accountDeleted: function() {
@@ -831,9 +831,16 @@ MailUniverse.prototype = {
* a bad login notification.
*/
__reportAccountProblem: function(account, problem) {
+ var suppress = false;
// nothing to do if the problem is already known
- if (account.problems.indexOf(problem) !== -1)
+ if (account.problems.indexOf(problem) !== -1) {
+ suppress = true;
+ }
+ this._LOG.reportProblem(problem, suppress, account.id);
+ if (suppress) {
return;
+ }
+
account.problems.push(problem);
account.enabled = false;
@@ -863,6 +870,7 @@ MailUniverse.prototype = {
},
clearAccountProblems: function(account) {
+ this._LOG.clearAccountProblems(account.id);
// TODO: this would be a great time to have any slices that had stalled
// syncs do whatever it takes to make them happen again.
account.enabled = true;
@@ -1995,6 +2003,8 @@ var LOGFAB = exports.LOGFAB = $log.register($module, {
configMigrating: {},
configLoaded: {},
createAccount: { type: true, id: false },
+ reportProblem: { type: true, suppressed: true, id: false },
+ clearAccountProblems: { id: false },
opDeferred: { type: true, id: false },
opTryLimitReached: { type: true, id: false },
opGaveUp: { type: true, id: false },
@@ -223,9 +223,11 @@ var properties = {
}
this._conn = null;
}
+ this._LOG.checkAccount_begin(null);
this.withConnection(function(err) {
+ this._LOG.checkAccount_end(err);
callback(err);
- }, 'checkAccount');
+ }.bind(this), 'checkAccount');
},
/**
@@ -226,10 +226,23 @@ var TestUniverseMixins = {
});
var bouncedSendMessage = $router.registerSimple(
'bounced-bridge',
- function(data) {
- TMA.__bridgeReceive(data.args);
+ function(msg) {
+ // we duplicate the logic of __bridgeReceive here a little to
+ // figure out whether this is a deferral or not. If it is a
+ // deferral, we log it as such. We log processing by decorating
+ // MailAPI._processMessage.
+ if (TMA._processingMessage && msg.type !== 'pong') {
+ self._bridgeLog.apiDefer(msg.type, msg);
+ }
+ TMA.__bridgeReceive(msg.args);
});
+ var origProcessMessage = TMA._processMessage;
+ TMA._processMessage = function(msg) {
+ self._bridgeLog.apiProcess(msg.type, msg);
+ origProcessMessage.call(TMA, msg);
+ };
+
TMA.__bridgeSend = function(msg) {
self._bridgeLog.apiSend(msg.type, msg);
// 'bridge' => main => 'bounced-bridge'
@@ -2655,6 +2668,8 @@ var LOGFAB = exports.LOGFAB = $log.register($module, {
subtype: $log.CLIENT,
events: {
apiSend: { type: false, msg: false },
+ apiDefer: { type: false, msg: false },
+ apiProcess: { type: false, msg: false },
bridgeSend: { type: false, msg: false },
},
},
@@ -75,6 +75,13 @@ TD.commonCase('reports bad password', function(T, RT) {
testAccount.eBackoff.expect_state('broken');
}
+ // this is a front-end side (unsolicited) notification that fires as a
+ // result of the back-end side call to checkAccount triggering a call to
+ // __reportAccountProblems since the account had no problems prior to the
+ // password changing. This will ALWAYS fire after the checkAccount callback
+ // because the callback happens in the back-end context, whereas this
+ // notification will fire in a future turn of the event loop because it is
+ // sent across our postMessage bridge(s).
testUniverse.MailAPI.onbadlogin = function(acct) {
eCheck.event('badlogin');
};
@@ -94,25 +101,33 @@ TD.commonCase('reports bad password', function(T, RT) {
T.group('pop3 handles connection drop on auth failure');
// clear problems from the previous failure so that we still
// receive proper onbadlogin events below
- T.action('clear account problems', eCheck, function() {
- var acct = testUniverse.allAccountsSlice.items[0];
- acct.clearProblems();
+ T.action(testUniverse.eUniverse, 'clear account problems', function() {
+ testUniverse.eUniverse.expect_clearAccountProblems(testAccount.id);
+
+ // Clear the problems on the back-end. This runs no checks and happens
+ // synchronously.
+ testUniverse.universe.clearAccountProblems(testAccount.account);
});
setDropOnAuthFailure(true);
- changeServerPassword('newPassword1', 'mismatch');
+ // our password is still a mismatch
T.action('create connection, should fail, generate MailAPI event',
eCheck, testAccount.eBackoff, function() {
eCheck.expect_namedValue('accountCheck:err', true);
eCheck.expect_namedValue('account:enabled', false);
+ // We only expect bad-user-or-pass because our clearAccountProblems
+ // call cleared the prior connection failure we had from the previous
+ // test step and the loss of the account during the authentication phase
+ // got folded into bad-user-or-pass.
eCheck.expect_namedValue('account:problems',
- ['bad-user-or-pass', 'connection']);
+ ['bad-user-or-pass']);
+ // testUniverse.MailAPI.onbadlogin is still going to log 'badlogin'
+ // from the previous steps. It will fire after the checkAccount call
+ // below for the same reason it did before; we've just cleared our
+ // account problems and so the side-effect of the back-end side call
+ // will result in an *unsolicited* badlogin notification.
eCheck.expect_event('badlogin');
- testUniverse.MailAPI.onbadlogin = function(acct) {
- eCheck.event('badlogin');
- };
-
testAccount.folderAccount.checkAccount(function(err) {
eCheck.namedValue('accountCheck:err', !!err);
eCheck.namedValue('account:enabled',
@@ -182,9 +182,11 @@ TD.commonCase('general reconnect logic', function(T) {
eCheck.expect_event('connection demand fulfilled');
eCheck.expect_namedValue('accountCheck:err', false);
testAccount.eBackoff.expect_state('healthy');
+ testAccount.eImapAccount.expect_checkAccount_begin(null);
testAccount.eImapAccount.expect_createConnection();
testAccount.eImapAccount.expect_reuseConnection();
testAccount.eImapAccount.expect_releaseConnection();
+ testAccount.eImapAccount.expect_checkAccount_end(null);
testAccount.imapAccount.checkAccount(function(err) {
eCheck.namedValue('accountCheck:err', !!err);
});

0 comments on commit 82a3fd4

Please sign in to comment.