Merge branch 'stable-2.15' into stable-2.16
* stable-2.15: ElasticContainer: Remove unneeded environment setting Remove redundant "testName" methods from Elasticsearch tests ElasticVersionTest: Add supportedVersion asserts for V7_0 Add support for Elasticsearch 7 Allow to set Elasticsearch number of shards and replicas Discontinue support for Elasticsearch 2.4.x ElasticSetting.Builder: Make methods return 'this' Add link to security documentation for Elasticsearch 6.5 ElasticVersionTest: Add missing tests for 6.5.x This merge also makes necessary changes related to the project index which is not implemented on stable-2.15: - Remove the tests for version 2.4.x - Add tests for version 7 Change-Id: Id39158eb94aa71a8a5b22702ccc2009f4ce48b8c
This commit is contained in:
@@ -2987,7 +2987,7 @@ WARNING: Support for Elasticsearch is still experimental and is not recommended
|
|||||||
for production use. For compatibility information, please refer to the
|
for production use. For compatibility information, please refer to the
|
||||||
link:https://www.gerritcodereview.com/elasticsearch.html[project homepage].
|
link:https://www.gerritcodereview.com/elasticsearch.html[project homepage].
|
||||||
|
|
||||||
When using Elasticsearch versions 2.4 and 5.6, the open and closed changes are
|
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`
|
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
|
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
|
merged into the default `_doc` type. The latter is also used for the accounts and
|
||||||
@@ -3024,6 +3024,22 @@ The value is in the usual time-unit format like `1 m`, `5 m`.
|
|||||||
+
|
+
|
||||||
Defaults to `30000 ms`.
|
Defaults to `30000 ms`.
|
||||||
|
|
||||||
|
[[elasticsearch.numberOfShards]]elasticsearch.numberOfShards::
|
||||||
|
+
|
||||||
|
Sets the number of shards to use per index. Refer to the
|
||||||
|
link:https://www.elastic.co/guide/en/elasticsearch/reference/current/_basic_concepts.html#getting-started-shards-and-replicas[
|
||||||
|
Elasticsearch documentation] for details.
|
||||||
|
+
|
||||||
|
Defaults to 5.
|
||||||
|
|
||||||
|
[[elasticsearch.numberOfReplicas]]elasticsearch.numberOfReplicas::
|
||||||
|
+
|
||||||
|
Sets the number of replicas to use per index. Refer to the
|
||||||
|
link:https://www.elastic.co/guide/en/elasticsearch/reference/current/_basic_concepts.html#getting-started-shards-and-replicas[
|
||||||
|
Elasticsearch documentation] for details.
|
||||||
|
+
|
||||||
|
Defaults to 1.
|
||||||
|
|
||||||
==== Elasticsearch Security
|
==== Elasticsearch Security
|
||||||
|
|
||||||
When security is enabled in Elasticsearch, the username and password must be provided.
|
When security is enabled in Elasticsearch, the username and password must be provided.
|
||||||
@@ -3031,11 +3047,11 @@ Note that the same username and password are used for all servers.
|
|||||||
|
|
||||||
For further information about Elasticsearch security, please refer to the documentation:
|
For further information about Elasticsearch security, please refer to the documentation:
|
||||||
|
|
||||||
* link:https://www.elastic.co/guide/en/elasticsearch/plugins/2.4/security.html[Elasticsearch 2.4]
|
|
||||||
* link:https://www.elastic.co/guide/en/x-pack/5.6/security-getting-started.html[Elasticsearch 5.6]
|
* link:https://www.elastic.co/guide/en/x-pack/5.6/security-getting-started.html[Elasticsearch 5.6]
|
||||||
* link:https://www.elastic.co/guide/en/x-pack/6.2/security-getting-started.html[Elasticsearch 6.2]
|
* link:https://www.elastic.co/guide/en/x-pack/6.2/security-getting-started.html[Elasticsearch 6.2]
|
||||||
* link:https://www.elastic.co/guide/en/elastic-stack-overview/6.3/security-getting-started.html[Elasticsearch 6.3]
|
* link:https://www.elastic.co/guide/en/elastic-stack-overview/6.3/security-getting-started.html[Elasticsearch 6.3]
|
||||||
* link:https://www.elastic.co/guide/en/elastic-stack-overview/6.4/security-getting-started.html[Elasticsearch 6.4]
|
* link:https://www.elastic.co/guide/en/elastic-stack-overview/6.4/security-getting-started.html[Elasticsearch 6.4]
|
||||||
|
* link:https://www.elastic.co/guide/en/elastic-stack-overview/6.5/security-getting-started.html[Elasticsearch 6.5]
|
||||||
|
|
||||||
[[elasticsearch.username]]elasticsearch.username::
|
[[elasticsearch.username]]elasticsearch.username::
|
||||||
+
|
+
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ abstract class AbstractElasticIndex<K, V> implements Index<K, V> {
|
|||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final ElasticConfiguration config;
|
||||||
private final Schema<V> schema;
|
private final Schema<V> schema;
|
||||||
private final SitePaths sitePaths;
|
private final SitePaths sitePaths;
|
||||||
private final String indexNameRaw;
|
private final String indexNameRaw;
|
||||||
@@ -118,17 +119,18 @@ abstract class AbstractElasticIndex<K, V> implements Index<K, V> {
|
|||||||
protected final ElasticQueryBuilder queryBuilder;
|
protected final ElasticQueryBuilder queryBuilder;
|
||||||
|
|
||||||
AbstractElasticIndex(
|
AbstractElasticIndex(
|
||||||
ElasticConfiguration cfg,
|
ElasticConfiguration config,
|
||||||
SitePaths sitePaths,
|
SitePaths sitePaths,
|
||||||
Schema<V> schema,
|
Schema<V> schema,
|
||||||
ElasticRestClientProvider client,
|
ElasticRestClientProvider client,
|
||||||
String indexName,
|
String indexName,
|
||||||
String indexType) {
|
String indexType) {
|
||||||
|
this.config = config;
|
||||||
this.sitePaths = sitePaths;
|
this.sitePaths = sitePaths;
|
||||||
this.schema = schema;
|
this.schema = schema;
|
||||||
this.gson = new GsonBuilder().setFieldNamingPolicy(LOWER_CASE_WITH_UNDERSCORES).create();
|
this.gson = new GsonBuilder().setFieldNamingPolicy(LOWER_CASE_WITH_UNDERSCORES).create();
|
||||||
this.queryBuilder = new ElasticQueryBuilder();
|
this.queryBuilder = new ElasticQueryBuilder();
|
||||||
this.indexName = cfg.getIndexName(indexName, schema.getVersion());
|
this.indexName = config.getIndexName(indexName, schema.getVersion());
|
||||||
this.indexNameRaw = indexName;
|
this.indexNameRaw = indexName;
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.type = client.adapter().getType(indexType);
|
this.type = client.adapter().getType(indexType);
|
||||||
@@ -199,7 +201,7 @@ abstract class AbstractElasticIndex<K, V> implements Index<K, V> {
|
|||||||
protected abstract String getMappings();
|
protected abstract String getMappings();
|
||||||
|
|
||||||
private String getSettings() {
|
private String getSettings() {
|
||||||
return gson.toJson(ImmutableMap.of(SETTINGS, ElasticSetting.createSetting()));
|
return gson.toJson(ImmutableMap.of(SETTINGS, ElasticSetting.createSetting(config)));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract String getId(V v);
|
protected abstract String getId(V v);
|
||||||
@@ -293,8 +295,11 @@ abstract class AbstractElasticIndex<K, V> implements Index<K, V> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected String getURI(String type, String request) throws UnsupportedEncodingException {
|
protected String getURI(String type, String request) throws UnsupportedEncodingException {
|
||||||
String encodedType = URLEncoder.encode(type, UTF_8.toString());
|
|
||||||
String encodedIndexName = URLEncoder.encode(indexName, UTF_8.toString());
|
String encodedIndexName = URLEncoder.encode(indexName, UTF_8.toString());
|
||||||
|
if (SEARCH.equals(request) && client.adapter().omitTypeFromSearch()) {
|
||||||
|
return encodedIndexName + "/" + request;
|
||||||
|
}
|
||||||
|
String encodedType = URLEncoder.encode(type, UTF_8.toString());
|
||||||
return encodedIndexName + "/" + encodedType + "/" + request;
|
return encodedIndexName + "/" + encodedType + "/" + request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,9 +40,13 @@ class ElasticConfiguration {
|
|||||||
static final String KEY_MAX_RETRY_TIMEOUT = "maxRetryTimeout";
|
static final String KEY_MAX_RETRY_TIMEOUT = "maxRetryTimeout";
|
||||||
static final String KEY_PREFIX = "prefix";
|
static final String KEY_PREFIX = "prefix";
|
||||||
static final String KEY_SERVER = "server";
|
static final String KEY_SERVER = "server";
|
||||||
|
static final String KEY_NUMBER_OF_SHARDS = "numberOfShards";
|
||||||
|
static final String KEY_NUMBER_OF_REPLICAS = "numberOfReplicas";
|
||||||
static final String DEFAULT_PORT = "9200";
|
static final String DEFAULT_PORT = "9200";
|
||||||
static final String DEFAULT_USERNAME = "elastic";
|
static final String DEFAULT_USERNAME = "elastic";
|
||||||
static final int DEFAULT_MAX_RETRY_TIMEOUT_MS = 30000;
|
static final int DEFAULT_MAX_RETRY_TIMEOUT_MS = 30000;
|
||||||
|
static final int DEFAULT_NUMBER_OF_SHARDS = 5;
|
||||||
|
static final int DEFAULT_NUMBER_OF_REPLICAS = 1;
|
||||||
static final TimeUnit MAX_RETRY_TIMEOUT_UNIT = TimeUnit.MILLISECONDS;
|
static final TimeUnit MAX_RETRY_TIMEOUT_UNIT = TimeUnit.MILLISECONDS;
|
||||||
|
|
||||||
private final Config cfg;
|
private final Config cfg;
|
||||||
@@ -51,6 +55,8 @@ class ElasticConfiguration {
|
|||||||
final String username;
|
final String username;
|
||||||
final String password;
|
final String password;
|
||||||
final int maxRetryTimeout;
|
final int maxRetryTimeout;
|
||||||
|
final int numberOfShards;
|
||||||
|
final int numberOfReplicas;
|
||||||
final String prefix;
|
final String prefix;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@@ -71,6 +77,10 @@ class ElasticConfiguration {
|
|||||||
DEFAULT_MAX_RETRY_TIMEOUT_MS,
|
DEFAULT_MAX_RETRY_TIMEOUT_MS,
|
||||||
MAX_RETRY_TIMEOUT_UNIT);
|
MAX_RETRY_TIMEOUT_UNIT);
|
||||||
this.prefix = Strings.nullToEmpty(cfg.getString(SECTION_ELASTICSEARCH, null, KEY_PREFIX));
|
this.prefix = Strings.nullToEmpty(cfg.getString(SECTION_ELASTICSEARCH, null, KEY_PREFIX));
|
||||||
|
this.numberOfShards =
|
||||||
|
cfg.getInt(SECTION_ELASTICSEARCH, null, KEY_NUMBER_OF_SHARDS, DEFAULT_NUMBER_OF_SHARDS);
|
||||||
|
this.numberOfReplicas =
|
||||||
|
cfg.getInt(SECTION_ELASTICSEARCH, null, KEY_NUMBER_OF_REPLICAS, DEFAULT_NUMBER_OF_REPLICAS);
|
||||||
this.hosts = new ArrayList<>();
|
this.hosts = new ArrayList<>();
|
||||||
for (String server : cfg.getStringList(SECTION_ELASTICSEARCH, null, KEY_SERVER)) {
|
for (String server : cfg.getStringList(SECTION_ELASTICSEARCH, null, KEY_SERVER)) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public class ElasticQueryAdapter {
|
|||||||
|
|
||||||
private final boolean ignoreUnmapped;
|
private final boolean ignoreUnmapped;
|
||||||
private final boolean usePostV5Type;
|
private final boolean usePostV5Type;
|
||||||
|
private final boolean omitTypeFromSearch;
|
||||||
|
|
||||||
private final String searchFilteringName;
|
private final String searchFilteringName;
|
||||||
private final String indicesExistParam;
|
private final String indicesExistParam;
|
||||||
@@ -31,33 +32,16 @@ public class ElasticQueryAdapter {
|
|||||||
private final String versionDiscoveryUrl;
|
private final String versionDiscoveryUrl;
|
||||||
|
|
||||||
ElasticQueryAdapter(ElasticVersion version) {
|
ElasticQueryAdapter(ElasticVersion version) {
|
||||||
this.ignoreUnmapped = version == ElasticVersion.V2_4;
|
this.ignoreUnmapped = false;
|
||||||
this.usePostV5Type = version.isV6();
|
this.usePostV5Type = version.isV6OrLater();
|
||||||
this.versionDiscoveryUrl = version.isV6() ? "/%s*" : "/%s*/_aliases";
|
this.omitTypeFromSearch = version.isV7OrLater();
|
||||||
|
this.versionDiscoveryUrl = version.isV6OrLater() ? "/%s*" : "/%s*/_aliases";
|
||||||
switch (version) {
|
this.searchFilteringName = "_source";
|
||||||
case V5_6:
|
this.indicesExistParam = "?allow_no_indices=false";
|
||||||
case V6_2:
|
this.exactFieldType = "keyword";
|
||||||
case V6_3:
|
this.stringFieldType = "text";
|
||||||
case V6_4:
|
this.indexProperty = "true";
|
||||||
case V6_5:
|
this.rawFieldsKey = "_source";
|
||||||
this.searchFilteringName = "_source";
|
|
||||||
this.indicesExistParam = "?allow_no_indices=false";
|
|
||||||
this.exactFieldType = "keyword";
|
|
||||||
this.stringFieldType = "text";
|
|
||||||
this.indexProperty = "true";
|
|
||||||
this.rawFieldsKey = "_source";
|
|
||||||
break;
|
|
||||||
case V2_4:
|
|
||||||
default:
|
|
||||||
this.searchFilteringName = "fields";
|
|
||||||
this.indicesExistParam = "";
|
|
||||||
this.exactFieldType = "string";
|
|
||||||
this.stringFieldType = "string";
|
|
||||||
this.indexProperty = "not_analyzed";
|
|
||||||
this.rawFieldsKey = "fields";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setIgnoreUnmapped(JsonObject properties) {
|
void setIgnoreUnmapped(JsonObject properties) {
|
||||||
@@ -100,8 +84,12 @@ public class ElasticQueryAdapter {
|
|||||||
return usePostV5Type;
|
return usePostV5Type;
|
||||||
}
|
}
|
||||||
|
|
||||||
String getType(String preV6Type) {
|
boolean omitTypeFromSearch() {
|
||||||
return usePostV5Type() ? POST_V5_TYPE : preV6Type;
|
return omitTypeFromSearch;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getType(String type) {
|
||||||
|
return usePostV5Type() ? POST_V5_TYPE : type;
|
||||||
}
|
}
|
||||||
|
|
||||||
String getVersionDiscoveryUrl(String name) {
|
String getVersionDiscoveryUrl(String name) {
|
||||||
|
|||||||
@@ -22,33 +22,33 @@ class ElasticSetting {
|
|||||||
private static final ImmutableMap<String, String> CUSTOM_CHAR_MAPPING =
|
private static final ImmutableMap<String, String> CUSTOM_CHAR_MAPPING =
|
||||||
ImmutableMap.of("\\u002E", "\\u0020", "\\u005F", "\\u0020");
|
ImmutableMap.of("\\u002E", "\\u0020", "\\u005F", "\\u0020");
|
||||||
|
|
||||||
static SettingProperties createSetting() {
|
static SettingProperties createSetting(ElasticConfiguration config) {
|
||||||
ElasticSetting.Builder settings = new ElasticSetting.Builder();
|
return new ElasticSetting.Builder().addCharFilter().addAnalyzer().build(config);
|
||||||
settings.addCharFilter();
|
|
||||||
settings.addAnalyzer();
|
|
||||||
return settings.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class Builder {
|
static class Builder {
|
||||||
private final ImmutableMap.Builder<String, FieldProperties> fields =
|
private final ImmutableMap.Builder<String, FieldProperties> fields =
|
||||||
new ImmutableMap.Builder<>();
|
new ImmutableMap.Builder<>();
|
||||||
|
|
||||||
SettingProperties build() {
|
SettingProperties build(ElasticConfiguration config) {
|
||||||
SettingProperties properties = new SettingProperties();
|
SettingProperties properties = new SettingProperties();
|
||||||
properties.analysis = fields.build();
|
properties.analysis = fields.build();
|
||||||
|
properties.numberOfShards = config.numberOfShards;
|
||||||
|
properties.numberOfReplicas = config.numberOfReplicas;
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addCharFilter() {
|
Builder addCharFilter() {
|
||||||
FieldProperties charMapping = new FieldProperties("mapping");
|
FieldProperties charMapping = new FieldProperties("mapping");
|
||||||
charMapping.mappings = getCustomCharMappings(CUSTOM_CHAR_MAPPING);
|
charMapping.mappings = getCustomCharMappings(CUSTOM_CHAR_MAPPING);
|
||||||
|
|
||||||
FieldProperties charFilter = new FieldProperties();
|
FieldProperties charFilter = new FieldProperties();
|
||||||
charFilter.customMapping = charMapping;
|
charFilter.customMapping = charMapping;
|
||||||
fields.put("char_filter", charFilter);
|
fields.put("char_filter", charFilter);
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addAnalyzer() {
|
Builder addAnalyzer() {
|
||||||
FieldProperties customAnalyzer = new FieldProperties("custom");
|
FieldProperties customAnalyzer = new FieldProperties("custom");
|
||||||
customAnalyzer.tokenizer = "standard";
|
customAnalyzer.tokenizer = "standard";
|
||||||
customAnalyzer.charFilter = new String[] {"custom_mapping"};
|
customAnalyzer.charFilter = new String[] {"custom_mapping"};
|
||||||
@@ -57,6 +57,7 @@ class ElasticSetting {
|
|||||||
FieldProperties analyzer = new FieldProperties();
|
FieldProperties analyzer = new FieldProperties();
|
||||||
analyzer.customWithCharFilter = customAnalyzer;
|
analyzer.customWithCharFilter = customAnalyzer;
|
||||||
fields.put("analyzer", analyzer);
|
fields.put("analyzer", analyzer);
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String[] getCustomCharMappings(ImmutableMap<String, String> map) {
|
private static String[] getCustomCharMappings(ImmutableMap<String, String> map) {
|
||||||
@@ -72,6 +73,8 @@ class ElasticSetting {
|
|||||||
|
|
||||||
static class SettingProperties {
|
static class SettingProperties {
|
||||||
Map<String, FieldProperties> analysis;
|
Map<String, FieldProperties> analysis;
|
||||||
|
Integer numberOfShards;
|
||||||
|
Integer numberOfReplicas;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class FieldProperties {
|
static class FieldProperties {
|
||||||
|
|||||||
@@ -18,12 +18,12 @@ import com.google.common.base.Joiner;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public enum ElasticVersion {
|
public enum ElasticVersion {
|
||||||
V2_4("2.4.*"),
|
|
||||||
V5_6("5.6.*"),
|
V5_6("5.6.*"),
|
||||||
V6_2("6.2.*"),
|
V6_2("6.2.*"),
|
||||||
V6_3("6.3.*"),
|
V6_3("6.3.*"),
|
||||||
V6_4("6.4.*"),
|
V6_4("6.4.*"),
|
||||||
V6_5("6.5.*");
|
V6_5("6.5.*"),
|
||||||
|
V7_0("7.0.*");
|
||||||
|
|
||||||
private final String version;
|
private final String version;
|
||||||
private final Pattern pattern;
|
private final Pattern pattern;
|
||||||
@@ -56,8 +56,16 @@ public enum ElasticVersion {
|
|||||||
return Joiner.on(", ").join(ElasticVersion.values());
|
return Joiner.on(", ").join(ElasticVersion.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isV6() {
|
public boolean isV6OrLater() {
|
||||||
return version.startsWith("6.");
|
return isAtLeastVersion(6);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isV7OrLater() {
|
||||||
|
return isAtLeastVersion(7);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isAtLeastVersion(int v) {
|
||||||
|
return Integer.valueOf(version.split("\\.")[0]) >= v;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -26,11 +26,6 @@ import org.junit.Before;
|
|||||||
public class ElasticReindexIT extends AbstractReindexTests {
|
public class ElasticReindexIT extends AbstractReindexTests {
|
||||||
|
|
||||||
@ConfigSuite.Default
|
@ConfigSuite.Default
|
||||||
public static Config elasticsearchV2() {
|
|
||||||
return getConfig(ElasticVersion.V2_4);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ConfigSuite.Config
|
|
||||||
public static Config elasticsearchV5() {
|
public static Config elasticsearchV5() {
|
||||||
return getConfig(ElasticVersion.V5_6);
|
return getConfig(ElasticVersion.V5_6);
|
||||||
}
|
}
|
||||||
@@ -40,6 +35,11 @@ public class ElasticReindexIT extends AbstractReindexTests {
|
|||||||
return getConfig(ElasticVersion.V6_5);
|
return getConfig(ElasticVersion.V6_5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigSuite.Config
|
||||||
|
public static Config elasticsearchV7() {
|
||||||
|
return getConfig(ElasticVersion.V7_0);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configureIndex(Injector injector) throws Exception {
|
public void configureIndex(Injector injector) throws Exception {
|
||||||
createAllIndexes(injector);
|
createAllIndexes(injector);
|
||||||
|
|||||||
@@ -25,11 +25,6 @@ import org.eclipse.jgit.lib.Config;
|
|||||||
public class ElasticIndexIT extends AbstractIndexTests {
|
public class ElasticIndexIT extends AbstractIndexTests {
|
||||||
|
|
||||||
@ConfigSuite.Default
|
@ConfigSuite.Default
|
||||||
public static Config elasticsearchV2() {
|
|
||||||
return getConfig(ElasticVersion.V2_4);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ConfigSuite.Config
|
|
||||||
public static Config elasticsearchV5() {
|
public static Config elasticsearchV5() {
|
||||||
return getConfig(ElasticVersion.V5_6);
|
return getConfig(ElasticVersion.V5_6);
|
||||||
}
|
}
|
||||||
@@ -39,6 +34,11 @@ public class ElasticIndexIT extends AbstractIndexTests {
|
|||||||
return getConfig(ElasticVersion.V6_5);
|
return getConfig(ElasticVersion.V6_5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigSuite.Config
|
||||||
|
public static Config elasticsearchV7() {
|
||||||
|
return getConfig(ElasticVersion.V7_0);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configureIndex(Injector injector) throws Exception {
|
public void configureIndex(Injector injector) throws Exception {
|
||||||
createAllIndexes(injector);
|
createAllIndexes(injector);
|
||||||
|
|||||||
@@ -40,26 +40,18 @@ TYPES = [
|
|||||||
|
|
||||||
SUFFIX = "sTest.java"
|
SUFFIX = "sTest.java"
|
||||||
|
|
||||||
ELASTICSEARCH_TESTS = {i: "ElasticQuery" + i.capitalize() + SUFFIX for i in TYPES}
|
|
||||||
|
|
||||||
ELASTICSEARCH_TESTS_V5 = {i: "ElasticV5Query" + i.capitalize() + SUFFIX for i in TYPES}
|
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_V6 = {i: "ElasticV6Query" + i.capitalize() + SUFFIX for i in TYPES}
|
||||||
|
|
||||||
|
ELASTICSEARCH_TESTS_V7 = {i: "ElasticV7Query" + i.capitalize() + SUFFIX for i in TYPES}
|
||||||
|
|
||||||
ELASTICSEARCH_TAGS = [
|
ELASTICSEARCH_TAGS = [
|
||||||
"docker",
|
"docker",
|
||||||
"elastic",
|
"elastic",
|
||||||
"exclusive",
|
"exclusive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[junit_tests(
|
|
||||||
name = "elasticsearch_query_%ss_test" % name,
|
|
||||||
size = "large",
|
|
||||||
srcs = [src],
|
|
||||||
tags = ELASTICSEARCH_TAGS,
|
|
||||||
deps = ELASTICSEARCH_DEPS + [QUERY_TESTS_DEP % name],
|
|
||||||
) for name, src in ELASTICSEARCH_TESTS.items()]
|
|
||||||
|
|
||||||
[junit_tests(
|
[junit_tests(
|
||||||
name = "elasticsearch_query_%ss_test_V5" % name,
|
name = "elasticsearch_query_%ss_test_V5" % name,
|
||||||
size = "large",
|
size = "large",
|
||||||
@@ -76,6 +68,14 @@ ELASTICSEARCH_TAGS = [
|
|||||||
deps = ELASTICSEARCH_DEPS + [QUERY_TESTS_DEP % name],
|
deps = ELASTICSEARCH_DEPS + [QUERY_TESTS_DEP % name],
|
||||||
) for name, src in ELASTICSEARCH_TESTS_V6.items()]
|
) for name, src in ELASTICSEARCH_TESTS_V6.items()]
|
||||||
|
|
||||||
|
[junit_tests(
|
||||||
|
name = "elasticsearch_query_%ss_test_V7" % name,
|
||||||
|
size = "large",
|
||||||
|
srcs = [src],
|
||||||
|
tags = ELASTICSEARCH_TAGS + ["flaky"],
|
||||||
|
deps = ELASTICSEARCH_DEPS + [QUERY_TESTS_DEP % name],
|
||||||
|
) for name, src in ELASTICSEARCH_TESTS_V7.items()]
|
||||||
|
|
||||||
junit_tests(
|
junit_tests(
|
||||||
name = "elasticsearch_tests",
|
name = "elasticsearch_tests",
|
||||||
size = "small",
|
size = "small",
|
||||||
|
|||||||
@@ -36,14 +36,8 @@ public class ElasticContainer<SELF extends ElasticContainer<SELF>> extends Gener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ElasticContainer<?> createAndStart() {
|
|
||||||
return createAndStart(ElasticVersion.V2_4);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getImageName(ElasticVersion version) {
|
private static String getImageName(ElasticVersion version) {
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case V2_4:
|
|
||||||
return "elasticsearch:2.4.6-alpine";
|
|
||||||
case V5_6:
|
case V5_6:
|
||||||
return "docker.elastic.co/elasticsearch/elasticsearch:5.6.13";
|
return "docker.elastic.co/elasticsearch/elasticsearch:5.6.13";
|
||||||
case V6_2:
|
case V6_2:
|
||||||
@@ -54,6 +48,8 @@ public class ElasticContainer<SELF extends ElasticContainer<SELF>> extends Gener
|
|||||||
return "docker.elastic.co/elasticsearch/elasticsearch-oss:6.4.3";
|
return "docker.elastic.co/elasticsearch/elasticsearch-oss:6.4.3";
|
||||||
case V6_5:
|
case V6_5:
|
||||||
return "docker.elastic.co/elasticsearch/elasticsearch-oss:6.5.1";
|
return "docker.elastic.co/elasticsearch/elasticsearch-oss:6.5.1";
|
||||||
|
case V7_0:
|
||||||
|
return "docker.elastic.co/elasticsearch/elasticsearch-oss:7.0.0-alpha1";
|
||||||
}
|
}
|
||||||
throw new IllegalStateException("No tests for version: " + version.name());
|
throw new IllegalStateException("No tests for version: " + version.name());
|
||||||
}
|
}
|
||||||
@@ -65,9 +61,6 @@ public class ElasticContainer<SELF extends ElasticContainer<SELF>> extends Gener
|
|||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
addExposedPort(ELASTICSEARCH_DEFAULT_PORT);
|
addExposedPort(ELASTICSEARCH_DEFAULT_PORT);
|
||||||
|
|
||||||
// https://github.com/docker-library/elasticsearch/issues/58
|
|
||||||
addEnv("-Ees.network.host", "0.0.0.0");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -52,10 +52,6 @@ public class ElasticV5QueryAccountsTest extends AbstractQueryAccountsTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String testName() {
|
|
||||||
return testName.getMethodName().toLowerCase() + "_";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initAfterLifecycleStart() throws Exception {
|
protected void initAfterLifecycleStart() throws Exception {
|
||||||
super.initAfterLifecycleStart();
|
super.initAfterLifecycleStart();
|
||||||
@@ -66,7 +62,7 @@ public class ElasticV5QueryAccountsTest extends AbstractQueryAccountsTest {
|
|||||||
protected Injector createInjector() {
|
protected Injector createInjector() {
|
||||||
Config elasticsearchConfig = new Config(config);
|
Config elasticsearchConfig = new Config(config);
|
||||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||||
String indicesPrefix = testName();
|
String indicesPrefix = getSanitizedMethodName();
|
||||||
ElasticTestUtils.configure(
|
ElasticTestUtils.configure(
|
||||||
elasticsearchConfig, nodeInfo.port, indicesPrefix, ElasticVersion.V5_6);
|
elasticsearchConfig, nodeInfo.port, indicesPrefix, ElasticVersion.V5_6);
|
||||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
||||||
|
|||||||
@@ -52,10 +52,6 @@ public class ElasticV5QueryChangesTest extends AbstractQueryChangesTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String testName() {
|
|
||||||
return testName.getMethodName().toLowerCase() + "_";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initAfterLifecycleStart() throws Exception {
|
protected void initAfterLifecycleStart() throws Exception {
|
||||||
super.initAfterLifecycleStart();
|
super.initAfterLifecycleStart();
|
||||||
@@ -66,7 +62,7 @@ public class ElasticV5QueryChangesTest extends AbstractQueryChangesTest {
|
|||||||
protected Injector createInjector() {
|
protected Injector createInjector() {
|
||||||
Config elasticsearchConfig = new Config(config);
|
Config elasticsearchConfig = new Config(config);
|
||||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||||
String indicesPrefix = testName();
|
String indicesPrefix = getSanitizedMethodName();
|
||||||
ElasticTestUtils.configure(
|
ElasticTestUtils.configure(
|
||||||
elasticsearchConfig, nodeInfo.port, indicesPrefix, ElasticVersion.V5_6);
|
elasticsearchConfig, nodeInfo.port, indicesPrefix, ElasticVersion.V5_6);
|
||||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
||||||
|
|||||||
@@ -52,10 +52,6 @@ public class ElasticV5QueryGroupsTest extends AbstractQueryGroupsTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String testName() {
|
|
||||||
return testName.getMethodName().toLowerCase() + "_";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initAfterLifecycleStart() throws Exception {
|
protected void initAfterLifecycleStart() throws Exception {
|
||||||
super.initAfterLifecycleStart();
|
super.initAfterLifecycleStart();
|
||||||
@@ -66,7 +62,7 @@ public class ElasticV5QueryGroupsTest extends AbstractQueryGroupsTest {
|
|||||||
protected Injector createInjector() {
|
protected Injector createInjector() {
|
||||||
Config elasticsearchConfig = new Config(config);
|
Config elasticsearchConfig = new Config(config);
|
||||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||||
String indicesPrefix = testName();
|
String indicesPrefix = getSanitizedMethodName();
|
||||||
ElasticTestUtils.configure(
|
ElasticTestUtils.configure(
|
||||||
elasticsearchConfig, nodeInfo.port, indicesPrefix, ElasticVersion.V5_6);
|
elasticsearchConfig, nodeInfo.port, indicesPrefix, ElasticVersion.V5_6);
|
||||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
||||||
|
|||||||
@@ -52,10 +52,6 @@ public class ElasticV5QueryProjectsTest extends AbstractQueryProjectsTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String testName() {
|
|
||||||
return testName.getMethodName().toLowerCase() + "_";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initAfterLifecycleStart() throws Exception {
|
protected void initAfterLifecycleStart() throws Exception {
|
||||||
super.initAfterLifecycleStart();
|
super.initAfterLifecycleStart();
|
||||||
@@ -66,7 +62,7 @@ public class ElasticV5QueryProjectsTest extends AbstractQueryProjectsTest {
|
|||||||
protected Injector createInjector() {
|
protected Injector createInjector() {
|
||||||
Config elasticsearchConfig = new Config(config);
|
Config elasticsearchConfig = new Config(config);
|
||||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||||
String indicesPrefix = testName();
|
String indicesPrefix = getSanitizedMethodName();
|
||||||
ElasticTestUtils.configure(
|
ElasticTestUtils.configure(
|
||||||
elasticsearchConfig, nodeInfo.port, indicesPrefix, ElasticVersion.V5_6);
|
elasticsearchConfig, nodeInfo.port, indicesPrefix, ElasticVersion.V5_6);
|
||||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
||||||
|
|||||||
@@ -52,10 +52,6 @@ public class ElasticV6QueryAccountsTest extends AbstractQueryAccountsTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String testName() {
|
|
||||||
return testName.getMethodName().toLowerCase() + "_";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initAfterLifecycleStart() throws Exception {
|
protected void initAfterLifecycleStart() throws Exception {
|
||||||
super.initAfterLifecycleStart();
|
super.initAfterLifecycleStart();
|
||||||
@@ -66,7 +62,7 @@ public class ElasticV6QueryAccountsTest extends AbstractQueryAccountsTest {
|
|||||||
protected Injector createInjector() {
|
protected Injector createInjector() {
|
||||||
Config elasticsearchConfig = new Config(config);
|
Config elasticsearchConfig = new Config(config);
|
||||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||||
String indicesPrefix = testName();
|
String indicesPrefix = getSanitizedMethodName();
|
||||||
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
||||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,10 +52,6 @@ public class ElasticV6QueryChangesTest extends AbstractQueryChangesTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String testName() {
|
|
||||||
return testName.getMethodName().toLowerCase() + "_";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initAfterLifecycleStart() throws Exception {
|
protected void initAfterLifecycleStart() throws Exception {
|
||||||
super.initAfterLifecycleStart();
|
super.initAfterLifecycleStart();
|
||||||
@@ -66,7 +62,7 @@ public class ElasticV6QueryChangesTest extends AbstractQueryChangesTest {
|
|||||||
protected Injector createInjector() {
|
protected Injector createInjector() {
|
||||||
Config elasticsearchConfig = new Config(config);
|
Config elasticsearchConfig = new Config(config);
|
||||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||||
String indicesPrefix = testName();
|
String indicesPrefix = getSanitizedMethodName();
|
||||||
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
||||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,10 +52,6 @@ public class ElasticV6QueryGroupsTest extends AbstractQueryGroupsTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String testName() {
|
|
||||||
return testName.getMethodName().toLowerCase() + "_";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initAfterLifecycleStart() throws Exception {
|
protected void initAfterLifecycleStart() throws Exception {
|
||||||
super.initAfterLifecycleStart();
|
super.initAfterLifecycleStart();
|
||||||
@@ -66,7 +62,7 @@ public class ElasticV6QueryGroupsTest extends AbstractQueryGroupsTest {
|
|||||||
protected Injector createInjector() {
|
protected Injector createInjector() {
|
||||||
Config elasticsearchConfig = new Config(config);
|
Config elasticsearchConfig = new Config(config);
|
||||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||||
String indicesPrefix = testName();
|
String indicesPrefix = getSanitizedMethodName();
|
||||||
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
||||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,10 +52,6 @@ public class ElasticV6QueryProjectsTest extends AbstractQueryProjectsTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String testName() {
|
|
||||||
return testName.getMethodName().toLowerCase() + "_";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initAfterLifecycleStart() throws Exception {
|
protected void initAfterLifecycleStart() throws Exception {
|
||||||
super.initAfterLifecycleStart();
|
super.initAfterLifecycleStart();
|
||||||
@@ -66,7 +62,7 @@ public class ElasticV6QueryProjectsTest extends AbstractQueryProjectsTest {
|
|||||||
protected Injector createInjector() {
|
protected Injector createInjector() {
|
||||||
Config elasticsearchConfig = new Config(config);
|
Config elasticsearchConfig = new Config(config);
|
||||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||||
String indicesPrefix = testName();
|
String indicesPrefix = getSanitizedMethodName();
|
||||||
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
||||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2016 The Android Open Source Project
|
// Copyright (C) 2018 The Android Open Source Project
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
@@ -25,7 +25,7 @@ import org.eclipse.jgit.lib.Config;
|
|||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
|
||||||
public class ElasticQueryAccountsTest extends AbstractQueryAccountsTest {
|
public class ElasticV7QueryAccountsTest extends AbstractQueryAccountsTest {
|
||||||
@ConfigSuite.Default
|
@ConfigSuite.Default
|
||||||
public static Config defaultConfig() {
|
public static Config defaultConfig() {
|
||||||
return IndexConfig.createForElasticsearch();
|
return IndexConfig.createForElasticsearch();
|
||||||
@@ -41,7 +41,7 @@ public class ElasticQueryAccountsTest extends AbstractQueryAccountsTest {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
container = ElasticContainer.createAndStart();
|
container = ElasticContainer.createAndStart(ElasticVersion.V7_0);
|
||||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,10 +52,6 @@ public class ElasticQueryAccountsTest extends AbstractQueryAccountsTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String testName() {
|
|
||||||
return testName.getMethodName().toLowerCase() + "_";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initAfterLifecycleStart() throws Exception {
|
protected void initAfterLifecycleStart() throws Exception {
|
||||||
super.initAfterLifecycleStart();
|
super.initAfterLifecycleStart();
|
||||||
@@ -66,7 +62,7 @@ public class ElasticQueryAccountsTest extends AbstractQueryAccountsTest {
|
|||||||
protected Injector createInjector() {
|
protected Injector createInjector() {
|
||||||
Config elasticsearchConfig = new Config(config);
|
Config elasticsearchConfig = new Config(config);
|
||||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||||
String indicesPrefix = testName();
|
String indicesPrefix = getSanitizedMethodName();
|
||||||
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
||||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2014 The Android Open Source Project
|
// Copyright (C) 2018 The Android Open Source Project
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
@@ -25,7 +25,7 @@ import org.eclipse.jgit.lib.Config;
|
|||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
|
||||||
public class ElasticQueryChangesTest extends AbstractQueryChangesTest {
|
public class ElasticV7QueryChangesTest extends AbstractQueryChangesTest {
|
||||||
@ConfigSuite.Default
|
@ConfigSuite.Default
|
||||||
public static Config defaultConfig() {
|
public static Config defaultConfig() {
|
||||||
return IndexConfig.createForElasticsearch();
|
return IndexConfig.createForElasticsearch();
|
||||||
@@ -41,7 +41,7 @@ public class ElasticQueryChangesTest extends AbstractQueryChangesTest {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
container = ElasticContainer.createAndStart();
|
container = ElasticContainer.createAndStart(ElasticVersion.V7_0);
|
||||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,10 +52,6 @@ public class ElasticQueryChangesTest extends AbstractQueryChangesTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String testName() {
|
|
||||||
return testName.getMethodName().toLowerCase() + "_";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initAfterLifecycleStart() throws Exception {
|
protected void initAfterLifecycleStart() throws Exception {
|
||||||
super.initAfterLifecycleStart();
|
super.initAfterLifecycleStart();
|
||||||
@@ -66,7 +62,7 @@ public class ElasticQueryChangesTest extends AbstractQueryChangesTest {
|
|||||||
protected Injector createInjector() {
|
protected Injector createInjector() {
|
||||||
Config elasticsearchConfig = new Config(config);
|
Config elasticsearchConfig = new Config(config);
|
||||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||||
String indicesPrefix = testName();
|
String indicesPrefix = getSanitizedMethodName();
|
||||||
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
||||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2017 The Android Open Source Project
|
// Copyright (C) 2018 The Android Open Source Project
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
@@ -25,7 +25,7 @@ import org.eclipse.jgit.lib.Config;
|
|||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
|
||||||
public class ElasticQueryGroupsTest extends AbstractQueryGroupsTest {
|
public class ElasticV7QueryGroupsTest extends AbstractQueryGroupsTest {
|
||||||
@ConfigSuite.Default
|
@ConfigSuite.Default
|
||||||
public static Config defaultConfig() {
|
public static Config defaultConfig() {
|
||||||
return IndexConfig.createForElasticsearch();
|
return IndexConfig.createForElasticsearch();
|
||||||
@@ -41,7 +41,7 @@ public class ElasticQueryGroupsTest extends AbstractQueryGroupsTest {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
container = ElasticContainer.createAndStart();
|
container = ElasticContainer.createAndStart(ElasticVersion.V7_0);
|
||||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,10 +52,6 @@ public class ElasticQueryGroupsTest extends AbstractQueryGroupsTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String testName() {
|
|
||||||
return testName.getMethodName().toLowerCase() + "_";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initAfterLifecycleStart() throws Exception {
|
protected void initAfterLifecycleStart() throws Exception {
|
||||||
super.initAfterLifecycleStart();
|
super.initAfterLifecycleStart();
|
||||||
@@ -66,7 +62,7 @@ public class ElasticQueryGroupsTest extends AbstractQueryGroupsTest {
|
|||||||
protected Injector createInjector() {
|
protected Injector createInjector() {
|
||||||
Config elasticsearchConfig = new Config(config);
|
Config elasticsearchConfig = new Config(config);
|
||||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||||
String indicesPrefix = testName();
|
String indicesPrefix = getSanitizedMethodName();
|
||||||
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
||||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2017 The Android Open Source Project
|
// Copyright (C) 2018 The Android Open Source Project
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
@@ -25,7 +25,7 @@ import org.eclipse.jgit.lib.Config;
|
|||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
|
||||||
public class ElasticQueryProjectsTest extends AbstractQueryProjectsTest {
|
public class ElasticV7QueryProjectsTest extends AbstractQueryProjectsTest {
|
||||||
@ConfigSuite.Default
|
@ConfigSuite.Default
|
||||||
public static Config defaultConfig() {
|
public static Config defaultConfig() {
|
||||||
return IndexConfig.createForElasticsearch();
|
return IndexConfig.createForElasticsearch();
|
||||||
@@ -41,7 +41,7 @@ public class ElasticQueryProjectsTest extends AbstractQueryProjectsTest {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
container = ElasticContainer.createAndStart();
|
container = ElasticContainer.createAndStart(ElasticVersion.V7_0);
|
||||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,10 +52,6 @@ public class ElasticQueryProjectsTest extends AbstractQueryProjectsTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String testName() {
|
|
||||||
return testName.getMethodName().toLowerCase() + "_";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initAfterLifecycleStart() throws Exception {
|
protected void initAfterLifecycleStart() throws Exception {
|
||||||
super.initAfterLifecycleStart();
|
super.initAfterLifecycleStart();
|
||||||
@@ -66,7 +62,7 @@ public class ElasticQueryProjectsTest extends AbstractQueryProjectsTest {
|
|||||||
protected Injector createInjector() {
|
protected Injector createInjector() {
|
||||||
Config elasticsearchConfig = new Config(config);
|
Config elasticsearchConfig = new Config(config);
|
||||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||||
String indicesPrefix = testName();
|
String indicesPrefix = getSanitizedMethodName();
|
||||||
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
||||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
||||||
}
|
}
|
||||||
@@ -25,9 +25,6 @@ public class ElasticVersionTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void supportedVersion() throws Exception {
|
public void supportedVersion() throws Exception {
|
||||||
assertThat(ElasticVersion.forVersion("2.4.0")).isEqualTo(ElasticVersion.V2_4);
|
|
||||||
assertThat(ElasticVersion.forVersion("2.4.6")).isEqualTo(ElasticVersion.V2_4);
|
|
||||||
|
|
||||||
assertThat(ElasticVersion.forVersion("5.6.0")).isEqualTo(ElasticVersion.V5_6);
|
assertThat(ElasticVersion.forVersion("5.6.0")).isEqualTo(ElasticVersion.V5_6);
|
||||||
assertThat(ElasticVersion.forVersion("5.6.11")).isEqualTo(ElasticVersion.V5_6);
|
assertThat(ElasticVersion.forVersion("5.6.11")).isEqualTo(ElasticVersion.V5_6);
|
||||||
|
|
||||||
@@ -39,6 +36,12 @@ public class ElasticVersionTest {
|
|||||||
|
|
||||||
assertThat(ElasticVersion.forVersion("6.4.0")).isEqualTo(ElasticVersion.V6_4);
|
assertThat(ElasticVersion.forVersion("6.4.0")).isEqualTo(ElasticVersion.V6_4);
|
||||||
assertThat(ElasticVersion.forVersion("6.4.1")).isEqualTo(ElasticVersion.V6_4);
|
assertThat(ElasticVersion.forVersion("6.4.1")).isEqualTo(ElasticVersion.V6_4);
|
||||||
|
|
||||||
|
assertThat(ElasticVersion.forVersion("6.5.0")).isEqualTo(ElasticVersion.V6_5);
|
||||||
|
assertThat(ElasticVersion.forVersion("6.5.1")).isEqualTo(ElasticVersion.V6_5);
|
||||||
|
|
||||||
|
assertThat(ElasticVersion.forVersion("7.0.0")).isEqualTo(ElasticVersion.V7_0);
|
||||||
|
assertThat(ElasticVersion.forVersion("7.0.1")).isEqualTo(ElasticVersion.V7_0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -51,9 +54,19 @@ public class ElasticVersionTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void version6() throws Exception {
|
public void version6() throws Exception {
|
||||||
assertThat(ElasticVersion.V6_2.isV6()).isTrue();
|
assertThat(ElasticVersion.V5_6.isV6OrLater()).isFalse();
|
||||||
assertThat(ElasticVersion.V6_3.isV6()).isTrue();
|
assertThat(ElasticVersion.V6_2.isV6OrLater()).isTrue();
|
||||||
assertThat(ElasticVersion.V6_4.isV6()).isTrue();
|
assertThat(ElasticVersion.V6_3.isV6OrLater()).isTrue();
|
||||||
assertThat(ElasticVersion.V5_6.isV6()).isFalse();
|
assertThat(ElasticVersion.V6_4.isV6OrLater()).isTrue();
|
||||||
|
assertThat(ElasticVersion.V7_0.isV6OrLater()).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void version7() 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();
|
||||||
|
assertThat(ElasticVersion.V7_0.isV7OrLater()).isTrue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user