AbstractElasticIndex: fix index name of delete request and add coverage

Previously the deletion of the index failed because of the improper
index name. This change fixes the index name of the delete request so
that the objects (i.e., groups, accounts or changes) that exist in the
index can be deleted.

This change also adds the test to delete a change from the index in
order to test this fix and add coverage for the getDeleteActions method
in ElasticChangeIndex.

Bug: Issue 9040
Change-Id: I891bd4dc286f7bf0cfeb95de1c952d91ae631ba4
This commit is contained in:
Borui Tao
2018-05-30 15:36:14 -04:00
committed by David Pursehouse
parent 9a780a75e3
commit bb412404dc
2 changed files with 13 additions and 1 deletions

View File

@@ -2205,6 +2205,18 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
assertQuery("owner: \"" + nameEmail + "\"\\");
}
@Test
public void byDeletedChange() throws Exception {
TestRepository<Repo> repo = createProject("repo");
Change change = insert(repo, newChange(repo));
String query = "change:" + change.getId();
assertQuery(query, change);
gApi.changes().id(change.getChangeId()).delete();
assertQuery(query);
}
protected ChangeInserter newChange(TestRepository<Repo> repo) throws Exception {
return newChange(repo, null, null, null, null);
}