AbstractQueryAccountsTest: Add byDeletedAccount to ensure consistency
The byDeletedChange and byDeletedGroup tests have been added to AbstractQueryChangesTest and AbstractQueryGroupsTest respectively. However, the corresponding test for deleting accounts was missing. This change adds the byDeleteAccount so that the behavior of deleting accounts from the index is validated. Also, this change ensures that the tests for changes, groups, and accounts are consistent. Bug: Issue 9040 Change-Id: I0cf45694cba485812d286c7b9939b921f0f8eb22
This commit is contained in:
committed by
David Pursehouse
parent
2a727f8b79
commit
99289a5f83
@@ -50,6 +50,8 @@ import com.google.gerrit.server.account.AccountManager;
|
||||
import com.google.gerrit.server.account.AccountState;
|
||||
import com.google.gerrit.server.account.AuthRequest;
|
||||
import com.google.gerrit.server.config.AllProjectsName;
|
||||
import com.google.gerrit.server.index.account.AccountIndex;
|
||||
import com.google.gerrit.server.index.account.AccountIndexCollection;
|
||||
import com.google.gerrit.server.schema.SchemaCreator;
|
||||
import com.google.gerrit.server.util.ManualRequestContext;
|
||||
import com.google.gerrit.server.util.OneOffRequestContext;
|
||||
@@ -105,6 +107,8 @@ public abstract class AbstractQueryAccountsTest extends GerritServerTests {
|
||||
|
||||
@Inject protected AllProjectsName allProjects;
|
||||
|
||||
@Inject protected AccountIndexCollection accountIndexes;
|
||||
|
||||
protected Injector injector;
|
||||
protected LifecycleManager lifecycle;
|
||||
protected ReviewDb db;
|
||||
@@ -322,6 +326,18 @@ public abstract class AbstractQueryAccountsTest extends GerritServerTests {
|
||||
assertAccounts(internalAccountQuery.byWatchedProject(allProjects), user3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void byDeletedAccount() throws Exception {
|
||||
AccountInfo user = newAccountWithFullName("jdoe", "John Doe");
|
||||
Account.Id userId = Account.Id.parse(user._accountId.toString());
|
||||
assertQuery("John", user);
|
||||
|
||||
for (AccountIndex index : accountIndexes.getWriteIndexes()) {
|
||||
index.delete(userId);
|
||||
}
|
||||
assertQuery("John");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withLimit() throws Exception {
|
||||
String domain = name("test.com");
|
||||
|
||||
Reference in New Issue
Block a user