Fix auto-adding reviewers during push

When we converted ReceiveCommits to use BatchUpdate's parallel
functionality in I40545a4d, we lost the automatic request scope
propagation. This was mostly fine, with the notable exception of:
 - pushing a new patch set of an existing change, and
 - pushing multiple changes so work is in a background thread, and
 - mentioning a user in a footer (Signed-Off-By, etc.), and
 - not including an email address in that footer, and
 - not having the account index enabled.

This would cause AccountResolver to try to call its
Provider<ReviewDb>, which fails because it's not in request scope.

Fix this by passing a ReviewDb into AccountResolver methods. That was
the easy part; the hard part was figuring out how to write a test case
that triggered this. Since the account index is now enabled by
default, this means putting a test-only hack into LuceneIndexModule
to support disabling a specific index. (This could also be useful for
other tests, since we currently don't exercise the non-index
fallbacks.)

Change-Id: I7231be3ea4660c9ee27f09994706b39ee622488a
This commit is contained in:
Dave Borowitz
2016-08-12 16:46:55 -04:00
committed by David Pursehouse
parent 9494ca8720
commit 040c39bcb3
13 changed files with 200 additions and 86 deletions

View File

@@ -85,7 +85,7 @@ public class LsUserRefs extends SshCommand {
protected void run() throws Failure {
Account userAccount;
try {
userAccount = accountResolver.find(userName);
userAccount = accountResolver.find(db, userName);
} catch (OrmException e) {
throw die(e);
}