Merge branch 'stable-3.0' into stable-3.1

* stable-3.0:
  Update git submodules
  ElasticV6QueryChangesTest: Close indices after test
  Update git submodules
  Add support for Elasticsearch version 7.5.*

Change-Id: I7469369ac5ea53ac1716ef9a5e433a91ad9b25af
This commit is contained in:
David Pursehouse 2019-12-04 15:19:32 +09:00
commit cfc012bce2
11 changed files with 38 additions and 11 deletions

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

@ -22,7 +22,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 +40,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 +51,8 @@ public class ElasticV6QueryChangesTest extends AbstractQueryChangesTest {
container = ElasticContainer.createAndStart(ElasticVersion.V6_8);
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
client = HttpAsyncClients.createDefault();
client.start();
}
@AfterClass
@ -54,6 +62,16 @@ public class ElasticV6QueryChangesTest extends AbstractQueryChangesTest {
}
}
@After
public void closeIndex() {
client.execute(
new HttpPost(
String.format(
"http://localhost:%d/%s*/_close", nodeInfo.port, getSanitizedMethodName())),
HttpClientContext.create(),
null);
}
@Rule public final GerritTestName testName = new GerritTestName();
@Override

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(