Remove support for discontinued Elasticsearch version 5.6

According to Elasticsearch release page: [1], the support for version
5.6 was discontinued on 2019-03-11.

[1] https://www.elastic.co/support/eol

Bug: Issue 12527
Change-Id: I1dfd9d54adcd9c92a17f478fcb3e5f3e642f9497
This commit is contained in:
David Ostrovsky
2020-04-04 15:09:32 +02:00
parent 2336606fb9
commit 81d2b5e18e
21 changed files with 30 additions and 406 deletions

View File

@@ -3143,11 +3143,9 @@ WARNING: Support for Elasticsearch is still experimental and is not recommended
for production use. For compatibility information, please refer to the
link:https://www.gerritcodereview.com/elasticsearch.html[project homepage].
When using Elasticsearch version 5.6, the open and closed changes are
indexed in a single index, separated into types `open_changes` and `closed_changes`
respectively. When using version 6.2 or later, the open and closed changes are
merged into the default `_doc` type. The latter is also used for the accounts and
groups indices starting with Elasticsearch 6.2.
In Elasticsearch version 6.2 or later, the open and closed changes are merged
into the default `_doc` type. The latter is also used for the accounts and groups
indices starting with Elasticsearch 6.2.
Note that when Gerrit is configured to use Elasticsearch, the Elasticsearch
server(s) must be reachable during the site initialization.

View File

@@ -126,8 +126,7 @@ abstract class AbstractElasticIndex<K, V> implements Index<K, V> {
SitePaths sitePaths,
Schema<V> schema,
ElasticRestClientProvider client,
String indexName,
String indexType) {
String indexName) {
this.config = config;
this.sitePaths = sitePaths;
this.schema = schema;
@@ -136,16 +135,7 @@ abstract class AbstractElasticIndex<K, V> implements Index<K, V> {
this.indexName = config.getIndexName(indexName, schema.getVersion());
this.indexNameRaw = indexName;
this.client = client;
this.type = client.adapter().getType(indexType);
}
AbstractElasticIndex(
ElasticConfiguration cfg,
SitePaths sitePaths,
Schema<V> schema,
ElasticRestClientProvider client,
String indexName) {
this(cfg, sitePaths, schema, client, indexName, indexName);
this.type = client.adapter().getType();
}
@Override
@@ -211,8 +201,8 @@ abstract class AbstractElasticIndex<K, V> implements Index<K, V> {
protected abstract String getId(V v);
protected String getMappingsForSingleType(String candidateType, MappingProperties properties) {
return getMappingsFor(client.adapter().getType(candidateType), properties);
protected String getMappingsForSingleType(MappingProperties properties) {
return getMappingsFor(client.adapter().getType(), properties);
}
protected String getMappingsFor(String type, MappingProperties properties) {
@@ -228,8 +218,8 @@ abstract class AbstractElasticIndex<K, V> implements Index<K, V> {
return gson.toJson(mappings);
}
protected String delete(String type, K id) {
return new DeleteRequest(id.toString(), indexName, type, client.adapter()).toString();
protected String getDeleteRequest(K id) {
return new DeleteRequest(id.toString(), indexName).toString();
}
protected abstract V fromDocument(JsonObject doc, Set<String> fields);

View File

@@ -74,9 +74,7 @@ public class ElasticAccountIndex extends AbstractElasticIndex<Account.Id, Accoun
@Override
public void replace(AccountState as) throws IOException {
BulkRequest bulk =
new IndexRequest(getId(as), indexName, type, client.adapter())
.add(new UpdateRequest<>(schema, as));
BulkRequest bulk = new IndexRequest(getId(as), indexName).add(new UpdateRequest<>(schema, as));
String uri = getURI(type, BULK);
Response response = postRequest(uri, bulk, getRefreshParam());
@@ -98,12 +96,12 @@ public class ElasticAccountIndex extends AbstractElasticIndex<Account.Id, Accoun
@Override
protected String getDeleteActions(Account.Id a) {
return delete(type, a);
return getDeleteRequest(a);
}
@Override
protected String getMappings() {
return getMappingsForSingleType(ACCOUNTS, mapping.accounts);
return getMappingsForSingleType(mapping.accounts);
}
@Override

View File

@@ -24,7 +24,6 @@ import static java.util.Objects.requireNonNull;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
@@ -32,7 +31,6 @@ import com.google.common.collect.MultimapBuilder;
import com.google.common.collect.Sets;
import com.google.gerrit.elasticsearch.ElasticMapping.MappingProperties;
import com.google.gerrit.elasticsearch.bulk.BulkRequest;
import com.google.gerrit.elasticsearch.bulk.DeleteRequest;
import com.google.gerrit.elasticsearch.bulk.IndexRequest;
import com.google.gerrit.elasticsearch.bulk.UpdateRequest;
import com.google.gerrit.index.QueryOptions;
@@ -42,7 +40,6 @@ import com.google.gerrit.index.query.Predicate;
import com.google.gerrit.index.query.QueryParseException;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Change.Id;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.server.ReviewDb;
import com.google.gerrit.server.ReviewerByEmailSet;
@@ -58,7 +55,6 @@ import com.google.gerrit.server.query.change.ChangeData;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gwtorm.server.OrmException;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.assistedinject.Assisted;
@@ -112,28 +108,7 @@ class ElasticChangeIndex extends AbstractElasticIndex<Change.Id, ChangeData>
@Override
public void replace(ChangeData cd) throws IOException {
String deleteIndex;
String insertIndex;
try {
if (cd.change().getStatus().isOpen()) {
insertIndex = OPEN_CHANGES;
deleteIndex = CLOSED_CHANGES;
} else {
insertIndex = CLOSED_CHANGES;
deleteIndex = OPEN_CHANGES;
}
} catch (OrmException e) {
throw new IOException(e);
}
ElasticQueryAdapter adapter = client.adapter();
BulkRequest bulk =
new IndexRequest(getId(cd), indexName, adapter.getType(insertIndex), adapter)
.add(new UpdateRequest<>(schema, cd));
if (adapter.deleteToReplace()) {
bulk.add(new DeleteRequest(cd.getId().toString(), indexName, deleteIndex, adapter));
}
BulkRequest bulk = new IndexRequest(getId(cd), indexName).add(new UpdateRequest<>(schema, cd));
String uri = getURI(type, BULK);
Response response = postRequest(uri, bulk, getRefreshParam());
@@ -185,20 +160,14 @@ class ElasticChangeIndex extends AbstractElasticIndex<Change.Id, ChangeData>
}
@Override
protected String getDeleteActions(Id c) {
if (!client.adapter().useV5Type()) {
return delete(client.adapter().getType(), c);
}
return delete(OPEN_CHANGES, c) + delete(CLOSED_CHANGES, c);
protected String getDeleteActions(Change.Id c) {
return getDeleteRequest(c);
}
@Override
protected String getMappings() {
if (!client.adapter().useV5Type()) {
return getMappingsFor(client.adapter().getType(), mapping.changes);
}
return gson.toJson(ImmutableMap.of(MAPPINGS, mapping));
}
@Override
protected String getId(ChangeData cd) {

View File

@@ -73,8 +73,7 @@ public class ElasticGroupIndex extends AbstractElasticIndex<AccountGroup.UUID, I
@Override
public void replace(InternalGroup group) throws IOException {
BulkRequest bulk =
new IndexRequest(getId(group), indexName, type, client.adapter())
.add(new UpdateRequest<>(schema, group));
new IndexRequest(getId(group), indexName).add(new UpdateRequest<>(schema, group));
String uri = getURI(type, BULK);
Response response = postRequest(uri, bulk, getRefreshParam());
@@ -96,12 +95,12 @@ public class ElasticGroupIndex extends AbstractElasticIndex<AccountGroup.UUID, I
@Override
protected String getDeleteActions(AccountGroup.UUID g) {
return delete(type, g);
return getDeleteRequest(g);
}
@Override
protected String getMappings() {
return getMappingsForSingleType(GROUPS, mapping.groups);
return getMappingsForSingleType(mapping.groups);
}
@Override

View File

@@ -73,7 +73,7 @@ public class ElasticProjectIndex extends AbstractElasticIndex<Project.NameKey, P
@Override
public void replace(ProjectData projectState) throws IOException {
BulkRequest bulk =
new IndexRequest(projectState.getProject().getName(), indexName, type, client.adapter())
new IndexRequest(projectState.getProject().getName(), indexName)
.add(new UpdateRequest<>(schema, projectState));
String uri = getURI(type, BULK);
@@ -96,12 +96,12 @@ public class ElasticProjectIndex extends AbstractElasticIndex<Project.NameKey, P
@Override
protected String getDeleteActions(Project.NameKey nameKey) {
return delete(type, nameKey);
return getDeleteRequest(nameKey);
}
@Override
protected String getMappings() {
return getMappingsForSingleType(PROJECTS, mapping.projects);
return getMappingsForSingleType(mapping.projects);
}
@Override

View File

@@ -16,15 +16,12 @@ package com.google.gerrit.elasticsearch;
import static com.google.gerrit.elasticsearch.ElasticVersion.V6_7;
import com.google.gson.JsonObject;
public class ElasticQueryAdapter {
static final String V6_TYPE = "_doc";
private static final String INCLUDE_TYPE = "include_type_name=true";
private static final String INDICES = "?allow_no_indices=false";
private final boolean useV5Type;
private final boolean useV6Type;
private final boolean omitType;
private final int defaultNumberOfShards;
@@ -39,7 +36,6 @@ public class ElasticQueryAdapter {
private final String includeTypeNameParam;
ElasticQueryAdapter(ElasticVersion version) {
this.useV5Type = !version.isV6OrLater();
this.useV6Type = version.isV6();
this.omitType = version.isV7OrLater();
this.defaultNumberOfShards = version.isV7OrLater() ? 1 : 5;
@@ -54,12 +50,6 @@ public class ElasticQueryAdapter {
this.includeTypeNameParam = version.isAtLeastMinorVersion(V6_7) ? "?" + INCLUDE_TYPE : "";
}
public void setType(JsonObject properties, String type) {
if (useV5Type) {
properties.addProperty("_type", type);
}
}
public String searchFilteringName() {
return searchFilteringName;
}
@@ -84,14 +74,6 @@ public class ElasticQueryAdapter {
return rawFieldsKey;
}
boolean deleteToReplace() {
return useV5Type;
}
boolean useV5Type() {
return useV5Type;
}
boolean useV6Type() {
return useV6Type;
}
@@ -105,14 +87,7 @@ public class ElasticQueryAdapter {
}
String getType() {
return getType("");
}
String getType(String type) {
if (useV6Type()) {
return V6_TYPE;
}
return useV5Type() ? type : "";
return useV6Type() ? V6_TYPE : "";
}
String getVersionDiscoveryUrl(String name) {

View File

@@ -18,7 +18,6 @@ import com.google.common.base.Joiner;
import java.util.regex.Pattern;
public enum ElasticVersion {
V5_6("5.6.*"),
V6_2("6.2.*"),
V6_3("6.3.*"),
V6_4("6.4.*"),

View File

@@ -14,7 +14,6 @@
package com.google.gerrit.elasticsearch.bulk;
import com.google.gerrit.elasticsearch.ElasticQueryAdapter;
import com.google.gson.JsonObject;
abstract class ActionRequest extends BulkRequest {
@@ -22,16 +21,11 @@ abstract class ActionRequest extends BulkRequest {
private final String action;
private final String id;
private final String index;
private final String type;
private final ElasticQueryAdapter adapter;
protected ActionRequest(
String action, String id, String index, String type, ElasticQueryAdapter adapter) {
protected ActionRequest(String action, String id, String index) {
this.action = action;
this.id = id;
this.index = index;
this.type = type;
this.adapter = adapter;
}
@Override
@@ -39,7 +33,6 @@ abstract class ActionRequest extends BulkRequest {
JsonObject properties = new JsonObject();
properties.addProperty("_id", id);
properties.addProperty("_index", index);
adapter.setType(properties, type);
JsonObject jsonAction = new JsonObject();
jsonAction.add(action, properties);

View File

@@ -14,11 +14,9 @@
package com.google.gerrit.elasticsearch.bulk;
import com.google.gerrit.elasticsearch.ElasticQueryAdapter;
public class DeleteRequest extends ActionRequest {
public DeleteRequest(String id, String index, String type, ElasticQueryAdapter adapter) {
super("delete", id, index, type, adapter);
public DeleteRequest(String id, String index) {
super("delete", id, index);
}
}

View File

@@ -14,11 +14,9 @@
package com.google.gerrit.elasticsearch.bulk;
import com.google.gerrit.elasticsearch.ElasticQueryAdapter;
public class IndexRequest extends ActionRequest {
public IndexRequest(String id, String index, String type, ElasticQueryAdapter adapter) {
super("index", id, index, type, adapter);
public IndexRequest(String id, String index) {
super("index", id, index);
}
}

View File

@@ -26,11 +26,6 @@ import org.junit.Before;
public class ElasticReindexIT extends AbstractReindexTests {
@ConfigSuite.Default
public static Config elasticsearchV5() {
return getConfig(ElasticVersion.V5_6);
}
@ConfigSuite.Config
public static Config elasticsearchV6() {
return getConfig(ElasticVersion.V6_8);
}

View File

@@ -25,11 +25,6 @@ import org.eclipse.jgit.lib.Config;
public class ElasticIndexIT extends AbstractIndexTests {
@ConfigSuite.Default
public static Config elasticsearchV5() {
return getConfig(ElasticVersion.V5_6);
}
@ConfigSuite.Config
public static Config elasticsearchV6() {
return getConfig(ElasticVersion.V6_8);
}

View File

@@ -48,8 +48,6 @@ TYPES = [
SUFFIX = "sTest.java"
ELASTICSEARCH_TESTS_V5 = {i: "ElasticV5Query" + i.capitalize() + SUFFIX for i in TYPES}
ELASTICSEARCH_TESTS_V6 = {i: "ElasticV6Query" + i.capitalize() + SUFFIX for i in TYPES}
ELASTICSEARCH_TESTS_V7 = {i: "ElasticV7Query" + i.capitalize() + SUFFIX for i in TYPES}
@@ -60,14 +58,6 @@ ELASTICSEARCH_TAGS = [
"exclusive",
]
[junit_tests(
name = "elasticsearch_query_%ss_test_V5" % name,
size = "large",
srcs = [src],
tags = ELASTICSEARCH_TAGS,
deps = ELASTICSEARCH_DEPS + [QUERY_TESTS_DEP % name],
) for name, src in ELASTICSEARCH_TESTS_V5.items()]
[junit_tests(
name = "elasticsearch_query_%ss_test_V6" % name,
size = "large",

View File

@@ -38,8 +38,6 @@ public class ElasticContainer extends ElasticsearchContainer {
private static String getImageName(ElasticVersion version) {
switch (version) {
case V5_6:
return "blacktop/elasticsearch:5.6.16";
case V6_2:
return "blacktop/elasticsearch:6.2.4";
case V6_3:

View File

@@ -25,22 +25,13 @@ import java.util.UUID;
import org.eclipse.jgit.lib.Config;
public final class ElasticTestUtils {
public static void configure(
Config config, ElasticContainer container, String prefix, ElasticVersion version) {
public static void configure(Config config, ElasticContainer container, String prefix) {
String hostname = container.getHttpHost().getHostName();
int port = container.getHttpHost().getPort();
config.setEnum("index", null, "type", IndexType.ELASTICSEARCH);
config.setString("elasticsearch", null, "server", "http://" + hostname + ":" + port);
config.setString("elasticsearch", null, "prefix", prefix);
config.setInt("index", null, "maxLimit", 10000);
String password = version == ElasticVersion.V5_6 ? "changeme" : null;
if (password != null) {
config.setString("elasticsearch", null, "password", password);
}
}
public static void configure(Config config, ElasticContainer container, String prefix) {
configure(config, container, prefix, null);
}
public static void createAllIndexes(Injector injector) throws IOException {
@@ -55,7 +46,7 @@ public final class ElasticTestUtils {
ElasticContainer container = ElasticContainer.createAndStart(version);
String indicesPrefix = UUID.randomUUID().toString();
Config cfg = new Config();
configure(cfg, container, indicesPrefix, version);
configure(cfg, container, indicesPrefix);
return cfg;
}

View File

@@ -1,64 +0,0 @@
// Copyright (C) 2018 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.elasticsearch;
import com.google.gerrit.server.query.account.AbstractQueryAccountsTest;
import com.google.gerrit.testing.ConfigSuite;
import com.google.gerrit.testing.InMemoryModule;
import com.google.gerrit.testing.IndexConfig;
import com.google.inject.Guice;
import com.google.inject.Injector;
import org.eclipse.jgit.lib.Config;
import org.junit.AfterClass;
import org.junit.BeforeClass;
public class ElasticV5QueryAccountsTest extends AbstractQueryAccountsTest {
@ConfigSuite.Default
public static Config defaultConfig() {
return IndexConfig.createForElasticsearch();
}
private static ElasticContainer container;
@BeforeClass
public static void startIndexService() {
if (container == null) {
// Only start Elasticsearch once
container = ElasticContainer.createAndStart(ElasticVersion.V5_6);
}
}
@AfterClass
public static void stopElasticsearchServer() {
if (container != null) {
container.stop();
}
}
@Override
protected void initAfterLifecycleStart() throws Exception {
super.initAfterLifecycleStart();
ElasticTestUtils.createAllIndexes(injector);
}
@Override
protected Injector createInjector() {
Config elasticsearchConfig = new Config(config);
InMemoryModule.setDefaults(elasticsearchConfig);
String indicesPrefix = getSanitizedMethodName();
ElasticTestUtils.configure(elasticsearchConfig, container, indicesPrefix, ElasticVersion.V5_6);
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
}
}

View File

@@ -1,64 +0,0 @@
// Copyright (C) 2018 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.elasticsearch;
import com.google.gerrit.server.query.change.AbstractQueryChangesTest;
import com.google.gerrit.testing.ConfigSuite;
import com.google.gerrit.testing.InMemoryModule;
import com.google.gerrit.testing.IndexConfig;
import com.google.inject.Guice;
import com.google.inject.Injector;
import org.eclipse.jgit.lib.Config;
import org.junit.AfterClass;
import org.junit.BeforeClass;
public class ElasticV5QueryChangesTest extends AbstractQueryChangesTest {
@ConfigSuite.Default
public static Config defaultConfig() {
return IndexConfig.createForElasticsearch();
}
private static ElasticContainer container;
@BeforeClass
public static void startIndexService() {
if (container == null) {
// Only start Elasticsearch once
container = ElasticContainer.createAndStart(ElasticVersion.V5_6);
}
}
@AfterClass
public static void stopElasticsearchServer() {
if (container != null) {
container.stop();
}
}
@Override
protected void initAfterLifecycleStart() throws Exception {
super.initAfterLifecycleStart();
ElasticTestUtils.createAllIndexes(injector);
}
@Override
protected Injector createInjector() {
Config elasticsearchConfig = new Config(config);
InMemoryModule.setDefaults(elasticsearchConfig);
String indicesPrefix = getSanitizedMethodName();
ElasticTestUtils.configure(elasticsearchConfig, container, indicesPrefix, ElasticVersion.V5_6);
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
}
}

View File

@@ -1,64 +0,0 @@
// Copyright (C) 2018 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.elasticsearch;
import com.google.gerrit.server.query.group.AbstractQueryGroupsTest;
import com.google.gerrit.testing.ConfigSuite;
import com.google.gerrit.testing.InMemoryModule;
import com.google.gerrit.testing.IndexConfig;
import com.google.inject.Guice;
import com.google.inject.Injector;
import org.eclipse.jgit.lib.Config;
import org.junit.AfterClass;
import org.junit.BeforeClass;
public class ElasticV5QueryGroupsTest extends AbstractQueryGroupsTest {
@ConfigSuite.Default
public static Config defaultConfig() {
return IndexConfig.createForElasticsearch();
}
private static ElasticContainer container;
@BeforeClass
public static void startIndexService() {
if (container == null) {
// Only start Elasticsearch once
container = ElasticContainer.createAndStart(ElasticVersion.V5_6);
}
}
@AfterClass
public static void stopElasticsearchServer() {
if (container != null) {
container.stop();
}
}
@Override
protected void initAfterLifecycleStart() throws Exception {
super.initAfterLifecycleStart();
ElasticTestUtils.createAllIndexes(injector);
}
@Override
protected Injector createInjector() {
Config elasticsearchConfig = new Config(config);
InMemoryModule.setDefaults(elasticsearchConfig);
String indicesPrefix = getSanitizedMethodName();
ElasticTestUtils.configure(elasticsearchConfig, container, indicesPrefix, ElasticVersion.V5_6);
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
}
}

View File

@@ -1,64 +0,0 @@
// Copyright (C) 2018 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.elasticsearch;
import com.google.gerrit.server.query.project.AbstractQueryProjectsTest;
import com.google.gerrit.testing.ConfigSuite;
import com.google.gerrit.testing.InMemoryModule;
import com.google.gerrit.testing.IndexConfig;
import com.google.inject.Guice;
import com.google.inject.Injector;
import org.eclipse.jgit.lib.Config;
import org.junit.AfterClass;
import org.junit.BeforeClass;
public class ElasticV5QueryProjectsTest extends AbstractQueryProjectsTest {
@ConfigSuite.Default
public static Config defaultConfig() {
return IndexConfig.createForElasticsearch();
}
private static ElasticContainer container;
@BeforeClass
public static void startIndexService() {
if (container == null) {
// Only start Elasticsearch once
container = ElasticContainer.createAndStart(ElasticVersion.V5_6);
}
}
@AfterClass
public static void stopElasticsearchServer() {
if (container != null) {
container.stop();
}
}
@Override
protected void initAfterLifecycleStart() throws Exception {
super.initAfterLifecycleStart();
ElasticTestUtils.createAllIndexes(injector);
}
@Override
protected Injector createInjector() {
Config elasticsearchConfig = new Config(config);
InMemoryModule.setDefaults(elasticsearchConfig);
String indicesPrefix = getSanitizedMethodName();
ElasticTestUtils.configure(elasticsearchConfig, container, indicesPrefix, ElasticVersion.V5_6);
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
}
}

View File

@@ -25,9 +25,6 @@ public class ElasticVersionTest {
@Test
public void supportedVersion() throws Exception {
assertThat(ElasticVersion.forVersion("5.6.0")).isEqualTo(ElasticVersion.V5_6);
assertThat(ElasticVersion.forVersion("5.6.11")).isEqualTo(ElasticVersion.V5_6);
assertThat(ElasticVersion.forVersion("6.2.0")).isEqualTo(ElasticVersion.V6_2);
assertThat(ElasticVersion.forVersion("6.2.4")).isEqualTo(ElasticVersion.V6_2);
@@ -81,7 +78,6 @@ public class ElasticVersionTest {
@Test
public void atLeastMinorVersion() throws Exception {
assertThat(ElasticVersion.V5_6.isAtLeastMinorVersion(ElasticVersion.V6_7)).isFalse();
assertThat(ElasticVersion.V6_2.isAtLeastMinorVersion(ElasticVersion.V6_7)).isFalse();
assertThat(ElasticVersion.V6_3.isAtLeastMinorVersion(ElasticVersion.V6_7)).isFalse();
assertThat(ElasticVersion.V6_4.isAtLeastMinorVersion(ElasticVersion.V6_7)).isFalse();
@@ -100,7 +96,6 @@ public class ElasticVersionTest {
@Test
public void version6OrLater() throws Exception {
assertThat(ElasticVersion.V5_6.isV6OrLater()).isFalse();
assertThat(ElasticVersion.V6_2.isV6OrLater()).isTrue();
assertThat(ElasticVersion.V6_3.isV6OrLater()).isTrue();
assertThat(ElasticVersion.V6_4.isV6OrLater()).isTrue();
@@ -119,7 +114,6 @@ public class ElasticVersionTest {
@Test
public void version7OrLater() throws Exception {
assertThat(ElasticVersion.V5_6.isV7OrLater()).isFalse();
assertThat(ElasticVersion.V6_2.isV7OrLater()).isFalse();
assertThat(ElasticVersion.V6_3.isV7OrLater()).isFalse();
assertThat(ElasticVersion.V6_4.isV7OrLater()).isFalse();