Merge branch 'stable-3.1'

* stable-3.1:
  ElasticV6QueryChangesTest: Align with changes done in V7
  Update git submodules
  Update git submodules
  ElasticV6QueryChangesTest: Close indices after test
  Update git submodules
  Switch PatchListCache to using legacy cache backend
  Replace guava caches with caffeine
  Fix undefined branch in create-destination-dialog
  Add support for Elasticsearch version 7.5.*

Change-Id: I436f3a67ce12ed618b48c30b02af5028b822d767
This commit is contained in:
David Pursehouse
2019-12-04 19:33:48 +09:00
12 changed files with 68 additions and 11 deletions

View File

@@ -235,6 +235,31 @@ maven_jar(
sha1 = GUAVA_BIN_SHA1,
)
CAFFEINE_VERS = "2.8.0"
maven_jar(
name = "caffeine",
artifact = "com.github.ben-manes.caffeine:caffeine:" + CAFFEINE_VERS,
sha1 = "6000774d7f8412ced005a704188ced78beeed2bb",
)
# TODO(davido): Rename guava.jar to caffeine-guava.jar on fetch to prevent potential
# naming collision between caffeine guava adapater and guava library itself.
# Remove this renaming procedure, once this upstream issue is fixed:
# https://github.com/ben-manes/caffeine/issues/364.
http_file(
name = "caffeine-guava-renamed",
downloaded_file_path = "caffeine-guava-" + CAFFEINE_VERS + ".jar",
sha256 = "3a66ee3ec70971dee0bae6e56bda7b8742bc4bedd7489161bfbbaaf7137d89e1",
urls = [
"https://repo1.maven.org/maven2/com/github/ben-manes/caffeine/guava/" +
CAFFEINE_VERS +
"/guava-" +
CAFFEINE_VERS +
".jar",
],
)
maven_jar(
name = "guava-failureaccess",
artifact = "com.google.guava:failureaccess:1.0.1",

View File

@@ -30,7 +30,8 @@ public enum ElasticVersion {
V7_1("7.1.*"),
V7_2("7.2.*"),
V7_3("7.3.*"),
V7_4("7.4.*");
V7_4("7.4.*"),
V7_5("7.5.*");
private final String version;
private final Pattern pattern;

View File

@@ -37,7 +37,7 @@ public class ElasticReindexIT extends AbstractReindexTests {
@ConfigSuite.Config
public static Config elasticsearchV7() {
return getConfig(ElasticVersion.V7_4);
return getConfig(ElasticVersion.V7_5);
}
@Override

View File

@@ -38,7 +38,7 @@ public class ElasticIndexIT extends AbstractIndexTests {
@ConfigSuite.Config
public static Config elasticsearchV7() {
return getConfig(ElasticVersion.V7_4);
return getConfig(ElasticVersion.V7_5);
}
@Override

View File

@@ -62,6 +62,8 @@ public class ElasticContainer extends ElasticsearchContainer {
return "blacktop/elasticsearch:7.3.2";
case V7_4:
return "blacktop/elasticsearch:7.4.2";
case V7_5:
return "blacktop/elasticsearch:7.5.0";
}
throw new IllegalStateException("No tests for version: " + version.name());
}

View File

@@ -14,6 +14,8 @@
package com.google.gerrit.elasticsearch;
import static java.util.concurrent.TimeUnit.MINUTES;
import com.google.gerrit.elasticsearch.ElasticTestUtils.ElasticNodeInfo;
import com.google.gerrit.server.query.change.AbstractQueryChangesTest;
import com.google.gerrit.testing.ConfigSuite;
@@ -22,7 +24,12 @@ import com.google.gerrit.testing.InMemoryModule;
import com.google.gerrit.testing.IndexConfig;
import com.google.inject.Guice;
import com.google.inject.Injector;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.impl.nio.client.CloseableHttpAsyncClient;
import org.apache.http.impl.nio.client.HttpAsyncClients;
import org.eclipse.jgit.lib.Config;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Rule;
@@ -35,6 +42,7 @@ public class ElasticV6QueryChangesTest extends AbstractQueryChangesTest {
private static ElasticNodeInfo nodeInfo;
private static ElasticContainer container;
private static CloseableHttpAsyncClient client;
@BeforeClass
public static void startIndexService() {
@@ -45,6 +53,8 @@ public class ElasticV6QueryChangesTest extends AbstractQueryChangesTest {
container = ElasticContainer.createAndStart(ElasticVersion.V6_8);
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
client = HttpAsyncClients.createDefault();
client.start();
}
@AfterClass
@@ -56,6 +66,19 @@ public class ElasticV6QueryChangesTest extends AbstractQueryChangesTest {
@Rule public final GerritTestName testName = new GerritTestName();
@After
public void closeIndex() throws Exception {
client
.execute(
new HttpPost(
String.format(
"http://localhost:%d/%s*/_close",
nodeInfo.port, testName.getSanitizedMethodName())),
HttpClientContext.create(),
null)
.get(5, MINUTES);
}
@Override
protected void initAfterLifecycleStart() throws Exception {
super.initAfterLifecycleStart();

View File

@@ -41,7 +41,7 @@ public class ElasticV7QueryAccountsTest extends AbstractQueryAccountsTest {
return;
}
container = ElasticContainer.createAndStart(ElasticVersion.V7_4);
container = ElasticContainer.createAndStart(ElasticVersion.V7_5);
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
}

View File

@@ -51,7 +51,7 @@ public class ElasticV7QueryChangesTest extends AbstractQueryChangesTest {
return;
}
container = ElasticContainer.createAndStart(ElasticVersion.V7_4);
container = ElasticContainer.createAndStart(ElasticVersion.V7_5);
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
client = HttpAsyncClients.createDefault();
client.start();

View File

@@ -41,7 +41,7 @@ public class ElasticV7QueryGroupsTest extends AbstractQueryGroupsTest {
return;
}
container = ElasticContainer.createAndStart(ElasticVersion.V7_4);
container = ElasticContainer.createAndStart(ElasticVersion.V7_5);
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
}

View File

@@ -41,7 +41,7 @@ public class ElasticV7QueryProjectsTest extends AbstractQueryProjectsTest {
return;
}
container = ElasticContainer.createAndStart(ElasticVersion.V7_4);
container = ElasticContainer.createAndStart(ElasticVersion.V7_5);
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
}

View File

@@ -60,6 +60,9 @@ public class ElasticVersionTest {
assertThat(ElasticVersion.forVersion("7.4.0")).isEqualTo(ElasticVersion.V7_4);
assertThat(ElasticVersion.forVersion("7.4.1")).isEqualTo(ElasticVersion.V7_4);
assertThat(ElasticVersion.forVersion("7.5.0")).isEqualTo(ElasticVersion.V7_5);
assertThat(ElasticVersion.forVersion("7.5.1")).isEqualTo(ElasticVersion.V7_5);
}
@Test
@@ -89,6 +92,7 @@ public class ElasticVersionTest {
assertThat(ElasticVersion.V7_2.isAtLeastMinorVersion(ElasticVersion.V6_7)).isFalse();
assertThat(ElasticVersion.V7_3.isAtLeastMinorVersion(ElasticVersion.V6_7)).isFalse();
assertThat(ElasticVersion.V7_4.isAtLeastMinorVersion(ElasticVersion.V6_7)).isFalse();
assertThat(ElasticVersion.V7_5.isAtLeastMinorVersion(ElasticVersion.V6_7)).isFalse();
}
@Test
@@ -106,6 +110,7 @@ public class ElasticVersionTest {
assertThat(ElasticVersion.V7_2.isV6OrLater()).isTrue();
assertThat(ElasticVersion.V7_3.isV6OrLater()).isTrue();
assertThat(ElasticVersion.V7_4.isV6OrLater()).isTrue();
assertThat(ElasticVersion.V7_5.isV6OrLater()).isTrue();
}
@Test
@@ -123,5 +128,6 @@ public class ElasticVersionTest {
assertThat(ElasticVersion.V7_2.isV7OrLater()).isTrue();
assertThat(ElasticVersion.V7_3.isV7OrLater()).isTrue();
assertThat(ElasticVersion.V7_4.isV7OrLater()).isTrue();
assertThat(ElasticVersion.V7_5.isV7OrLater()).isTrue();
}
}

View File

@@ -69,8 +69,8 @@ def declare_nongoogle_deps():
# elasticsearch-rest-client explicitly depends on this version
maven_jar(
name = "httpcore-nio",
artifact = "org.apache.httpcomponents:httpcore-nio:4.4.11",
sha1 = "7d0a97d01d39cff9aa3e6db81f21fddb2435f4e6",
artifact = "org.apache.httpcomponents:httpcore-nio:4.4.12",
sha1 = "84cd29eca842f31db02987cfedea245af020198b",
)
maven_jar(
@@ -102,8 +102,8 @@ def declare_nongoogle_deps():
# and httpasyncclient as necessary.
maven_jar(
name = "elasticsearch-rest-client",
artifact = "org.elasticsearch.client:elasticsearch-rest-client:7.4.2",
sha1 = "f48725523c0b3402f869214433602f8d3f4c737c",
artifact = "org.elasticsearch.client:elasticsearch-rest-client:7.5.0",
sha1 = "62535b6fc3a4e943e88e7640eac22e29f03a696d",
)
maven_jar(