Merge "AbstractElasticIndex: fix index name of delete request and add coverage" into stable-2.14

This commit is contained in:
David Pursehouse 2018-06-07 07:08:08 +00:00 committed by Gerrit Code Review
commit 70428fc5da
2 changed files with 13 additions and 1 deletions

View File

@ -157,7 +157,7 @@ abstract class AbstractElasticIndex<K, V> implements Index<K, V> {
protected abstract String getId(V v);
protected String delete(String type, K id) {
return new DeleteRequest(id.toString(), indexNameRaw, type).toString();
return new DeleteRequest(id.toString(), indexName, type).toString();
}
protected void addNamedElement(String name, JsonObject element, JsonArray array) {

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);
}