ElasticTestUtils: reuse project index name constant

Similar to Ifc1244f5, but that change was made on stable-2.14, which did
not yet have the project index. The refactoring outside of
ElasticTestUtils was causing tests to fail.

Change-Id: Ie8407b0304fde4db5e629fc9a8980005d6a9cf41
This commit is contained in:
Dave Borowitz
2018-04-05 13:26:32 -04:00
parent 7145fdfa24
commit 5a0f3d1235
2 changed files with 3 additions and 4 deletions

View File

@@ -54,7 +54,6 @@ public class ElasticProjectIndex extends AbstractElasticIndex<Project.NameKey, P
}
static final String PROJECTS = "projects";
static final String PROJECTS_PREFIX = PROJECTS + "_";
private final ProjectMapping mapping;
private final Provider<ProjectCache> projectCache;
@@ -66,7 +65,7 @@ public class ElasticProjectIndex extends AbstractElasticIndex<Project.NameKey, P
Provider<ProjectCache> projectCache,
JestClientBuilder clientBuilder,
@Assisted Schema<ProjectData> schema) {
super(cfg, sitePaths, schema, clientBuilder, PROJECTS_PREFIX);
super(cfg, sitePaths, schema, clientBuilder, PROJECTS);
this.projectCache = projectCache;
this.mapping = new ProjectMapping(schema);
}

View File

@@ -20,7 +20,7 @@ import static com.google.gerrit.elasticsearch.ElasticChangeIndex.CHANGES;
import static com.google.gerrit.elasticsearch.ElasticChangeIndex.CLOSED_CHANGES;
import static com.google.gerrit.elasticsearch.ElasticChangeIndex.OPEN_CHANGES;
import static com.google.gerrit.elasticsearch.ElasticGroupIndex.GROUPS;
import static com.google.gerrit.elasticsearch.ElasticProjectIndex.PROJECTS_PREFIX;
import static com.google.gerrit.elasticsearch.ElasticProjectIndex.PROJECTS;
import com.google.common.base.Strings;
import com.google.common.io.Files;
@@ -169,7 +169,7 @@ final class ElasticTestUtils {
.client()
.admin()
.indices()
.prepareCreate(String.format("%s%04d", PROJECTS_PREFIX, projectSchema.getVersion()))
.prepareCreate(String.format("%s_%04d", PROJECTS, projectSchema.getVersion()))
.addMapping(ElasticProjectIndex.PROJECTS, gson.toJson(projectMapping))
.execute()
.actionGet();