Merge branch 'stable-3.1'
* stable-3.1:
Do not assume ES is running on localhost in tests
Simplify creation of Elasticsearch containers in tests
Add debug logs for automatic account creation case
Elasticsearch: Unharcode localhost for container's
Documentation: Group contribution links in How-to
Documentation: Fix contributions link in CLA page
Disable ElasticV{5,6,7}QueryChangesTest because of Issue 12524.
Change-Id: I303475cb81ad32fb65e3981a0d3549853340a4dd
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
:linkattrs:
|
||||
= Gerrit Code Review - Contributor License Agreement
|
||||
|
||||
In order to link::dev-community.html#how-to-contribute[contribute] to
|
||||
In order to link:dev-community.html#how-to-contribute[contribute] to
|
||||
Gerrit a Contributor License Agreement must be completed before
|
||||
contributions are accepted. To view and accept the agreements do the
|
||||
following:
|
||||
|
||||
@@ -18,10 +18,7 @@ link:dev-cla.html[contributor's agreement] on file with the project.
|
||||
* link:dev-design.html[System Design]
|
||||
* Processes
|
||||
** link:dev-processes.html#project-governance[Project Governance / Engineering Steering Committee]
|
||||
** link:dev-contributing.html#contribution-processes[Contribution Processes]
|
||||
*** link:dev-contributing.html#lightweight-contribution-process[Lightweight Contribution Process]
|
||||
*** link:dev-contributing.html#design-driven-contribution-process[Design-Driven Contribution Process]
|
||||
*** link:dev-contributing.html#mentorship[Mentorship]
|
||||
** link:#how-to-contribute[Contribution Processes]
|
||||
** link:dev-design-docs.html#review[Design doc reviews]
|
||||
** link:dev-processes.html#dev-in-stable-branches[Development in stable branches]
|
||||
** link:dev-processes.html#backporting[Backporting to stable branches]
|
||||
|
||||
@@ -137,7 +137,9 @@ public class AccountManager {
|
||||
try {
|
||||
Optional<ExternalId> optionalExtId = externalIds.get(who.getExternalIdKey());
|
||||
if (!optionalExtId.isPresent()) {
|
||||
// New account, automatically create and return.
|
||||
logger.atFine().log(
|
||||
"External ID for account %s not found. A new account will be automatically created.",
|
||||
who.getUserName());
|
||||
return create(who);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,17 +23,12 @@ import java.util.UUID;
|
||||
import org.eclipse.jgit.lib.Config;
|
||||
|
||||
public final class ElasticTestUtils {
|
||||
public static class ElasticNodeInfo {
|
||||
public final int port;
|
||||
|
||||
public ElasticNodeInfo(int port) {
|
||||
this.port = port;
|
||||
}
|
||||
}
|
||||
|
||||
public static void configure(Config config, int port, String prefix, ElasticVersion version) {
|
||||
public static void configure(
|
||||
Config config, ElasticContainer container, String prefix, ElasticVersion version) {
|
||||
String hostname = container.getHttpHost().getHostName();
|
||||
int port = container.getHttpHost().getPort();
|
||||
config.setString("index", null, "type", "elasticsearch");
|
||||
config.setString("elasticsearch", null, "server", "http://localhost:" + port);
|
||||
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;
|
||||
@@ -42,8 +37,8 @@ public final class ElasticTestUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void configure(Config config, int port, String prefix) {
|
||||
configure(config, port, prefix, null);
|
||||
public static void configure(Config config, ElasticContainer container, String prefix) {
|
||||
configure(config, container, prefix, null);
|
||||
}
|
||||
|
||||
public static void createAllIndexes(Injector injector) {
|
||||
@@ -55,12 +50,10 @@ public final class ElasticTestUtils {
|
||||
}
|
||||
|
||||
public static Config getConfig(ElasticVersion version) {
|
||||
ElasticNodeInfo elasticNodeInfo;
|
||||
ElasticContainer container = ElasticContainer.createAndStart(version);
|
||||
elasticNodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||
String indicesPrefix = UUID.randomUUID().toString();
|
||||
Config cfg = new Config();
|
||||
configure(cfg, elasticNodeInfo.port, indicesPrefix, version);
|
||||
configure(cfg, container, indicesPrefix, version);
|
||||
return cfg;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
package com.google.gerrit.elasticsearch;
|
||||
|
||||
import com.google.gerrit.elasticsearch.ElasticTestUtils.ElasticNodeInfo;
|
||||
import com.google.gerrit.server.query.account.AbstractQueryAccountsTest;
|
||||
import com.google.gerrit.testing.ConfigSuite;
|
||||
import com.google.gerrit.testing.InMemoryModule;
|
||||
@@ -31,18 +30,14 @@ public class ElasticV5QueryAccountsTest extends AbstractQueryAccountsTest {
|
||||
return IndexConfig.createForElasticsearch();
|
||||
}
|
||||
|
||||
private static ElasticNodeInfo nodeInfo;
|
||||
private static ElasticContainer container;
|
||||
|
||||
@BeforeClass
|
||||
public static void startIndexService() {
|
||||
if (nodeInfo != null) {
|
||||
// do not start Elasticsearch twice
|
||||
return;
|
||||
if (container == null) {
|
||||
// Only start Elasticsearch once
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V5_6);
|
||||
}
|
||||
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V5_6);
|
||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@@ -63,8 +58,7 @@ public class ElasticV5QueryAccountsTest extends AbstractQueryAccountsTest {
|
||||
Config elasticsearchConfig = new Config(config);
|
||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||
String indicesPrefix = testName.getSanitizedMethodName();
|
||||
ElasticTestUtils.configure(
|
||||
elasticsearchConfig, nodeInfo.port, indicesPrefix, ElasticVersion.V5_6);
|
||||
ElasticTestUtils.configure(elasticsearchConfig, container, indicesPrefix, ElasticVersion.V5_6);
|
||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
package com.google.gerrit.elasticsearch;
|
||||
|
||||
import com.google.gerrit.elasticsearch.ElasticTestUtils.ElasticNodeInfo;
|
||||
import com.google.gerrit.server.query.change.AbstractQueryChangesTest;
|
||||
import com.google.gerrit.testing.ConfigSuite;
|
||||
import com.google.gerrit.testing.GerritTestName;
|
||||
@@ -25,26 +24,24 @@ import com.google.inject.Injector;
|
||||
import org.eclipse.jgit.lib.Config;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
|
||||
@Ignore("Tests failing because of the attention-set changes, see Issue 12524")
|
||||
public class ElasticV5QueryChangesTest extends AbstractQueryChangesTest {
|
||||
@ConfigSuite.Default
|
||||
public static Config defaultConfig() {
|
||||
return IndexConfig.createForElasticsearch();
|
||||
}
|
||||
|
||||
private static ElasticNodeInfo nodeInfo;
|
||||
private static ElasticContainer container;
|
||||
|
||||
@BeforeClass
|
||||
public static void startIndexService() {
|
||||
if (nodeInfo != null) {
|
||||
// do not start Elasticsearch twice
|
||||
return;
|
||||
if (container == null) {
|
||||
// Only start Elasticsearch once
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V5_6);
|
||||
}
|
||||
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V5_6);
|
||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@@ -67,8 +64,7 @@ public class ElasticV5QueryChangesTest extends AbstractQueryChangesTest {
|
||||
Config elasticsearchConfig = new Config(config);
|
||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||
String indicesPrefix = testName.getSanitizedMethodName();
|
||||
ElasticTestUtils.configure(
|
||||
elasticsearchConfig, nodeInfo.port, indicesPrefix, ElasticVersion.V5_6);
|
||||
ElasticTestUtils.configure(elasticsearchConfig, container, indicesPrefix, ElasticVersion.V5_6);
|
||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
package com.google.gerrit.elasticsearch;
|
||||
|
||||
import com.google.gerrit.elasticsearch.ElasticTestUtils.ElasticNodeInfo;
|
||||
import com.google.gerrit.server.query.group.AbstractQueryGroupsTest;
|
||||
import com.google.gerrit.testing.ConfigSuite;
|
||||
import com.google.gerrit.testing.InMemoryModule;
|
||||
@@ -31,18 +30,14 @@ public class ElasticV5QueryGroupsTest extends AbstractQueryGroupsTest {
|
||||
return IndexConfig.createForElasticsearch();
|
||||
}
|
||||
|
||||
private static ElasticNodeInfo nodeInfo;
|
||||
private static ElasticContainer container;
|
||||
|
||||
@BeforeClass
|
||||
public static void startIndexService() {
|
||||
if (nodeInfo != null) {
|
||||
// do not start Elasticsearch twice
|
||||
return;
|
||||
if (container == null) {
|
||||
// Only start Elasticsearch once
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V5_6);
|
||||
}
|
||||
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V5_6);
|
||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@@ -63,8 +58,7 @@ public class ElasticV5QueryGroupsTest extends AbstractQueryGroupsTest {
|
||||
Config elasticsearchConfig = new Config(config);
|
||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||
String indicesPrefix = testName.getSanitizedMethodName();
|
||||
ElasticTestUtils.configure(
|
||||
elasticsearchConfig, nodeInfo.port, indicesPrefix, ElasticVersion.V5_6);
|
||||
ElasticTestUtils.configure(elasticsearchConfig, container, indicesPrefix, ElasticVersion.V5_6);
|
||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
package com.google.gerrit.elasticsearch;
|
||||
|
||||
import com.google.gerrit.elasticsearch.ElasticTestUtils.ElasticNodeInfo;
|
||||
import com.google.gerrit.server.query.project.AbstractQueryProjectsTest;
|
||||
import com.google.gerrit.testing.ConfigSuite;
|
||||
import com.google.gerrit.testing.InMemoryModule;
|
||||
@@ -31,18 +30,14 @@ public class ElasticV5QueryProjectsTest extends AbstractQueryProjectsTest {
|
||||
return IndexConfig.createForElasticsearch();
|
||||
}
|
||||
|
||||
private static ElasticNodeInfo nodeInfo;
|
||||
private static ElasticContainer container;
|
||||
|
||||
@BeforeClass
|
||||
public static void startIndexService() {
|
||||
if (nodeInfo != null) {
|
||||
// do not start Elasticsearch twice
|
||||
return;
|
||||
if (container == null) {
|
||||
// Only start Elasticsearch once
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V5_6);
|
||||
}
|
||||
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V5_6);
|
||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@@ -63,8 +58,7 @@ public class ElasticV5QueryProjectsTest extends AbstractQueryProjectsTest {
|
||||
Config elasticsearchConfig = new Config(config);
|
||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||
String indicesPrefix = testName.getSanitizedMethodName();
|
||||
ElasticTestUtils.configure(
|
||||
elasticsearchConfig, nodeInfo.port, indicesPrefix, ElasticVersion.V5_6);
|
||||
ElasticTestUtils.configure(elasticsearchConfig, container, indicesPrefix, ElasticVersion.V5_6);
|
||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
package com.google.gerrit.elasticsearch;
|
||||
|
||||
import com.google.gerrit.elasticsearch.ElasticTestUtils.ElasticNodeInfo;
|
||||
import com.google.gerrit.server.query.account.AbstractQueryAccountsTest;
|
||||
import com.google.gerrit.testing.ConfigSuite;
|
||||
import com.google.gerrit.testing.InMemoryModule;
|
||||
@@ -31,18 +30,14 @@ public class ElasticV6QueryAccountsTest extends AbstractQueryAccountsTest {
|
||||
return IndexConfig.createForElasticsearch();
|
||||
}
|
||||
|
||||
private static ElasticNodeInfo nodeInfo;
|
||||
private static ElasticContainer container;
|
||||
|
||||
@BeforeClass
|
||||
public static void startIndexService() {
|
||||
if (nodeInfo != null) {
|
||||
// do not start Elasticsearch twice
|
||||
return;
|
||||
if (container == null) {
|
||||
// Only start Elasticsearch once
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V6_8);
|
||||
}
|
||||
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V6_8);
|
||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@@ -63,7 +58,7 @@ public class ElasticV6QueryAccountsTest extends AbstractQueryAccountsTest {
|
||||
Config elasticsearchConfig = new Config(config);
|
||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||
String indicesPrefix = testName.getSanitizedMethodName();
|
||||
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
||||
ElasticTestUtils.configure(elasticsearchConfig, container, indicesPrefix);
|
||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ 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;
|
||||
import com.google.gerrit.testing.GerritTestName;
|
||||
@@ -32,29 +31,27 @@ import org.eclipse.jgit.lib.Config;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
|
||||
@Ignore("Tests failing because of the attention-set changes, see Issue 12524")
|
||||
public class ElasticV6QueryChangesTest extends AbstractQueryChangesTest {
|
||||
@ConfigSuite.Default
|
||||
public static Config defaultConfig() {
|
||||
return IndexConfig.createForElasticsearch();
|
||||
}
|
||||
|
||||
private static ElasticNodeInfo nodeInfo;
|
||||
private static ElasticContainer container;
|
||||
private static CloseableHttpAsyncClient client;
|
||||
|
||||
@BeforeClass
|
||||
public static void startIndexService() {
|
||||
if (nodeInfo != null) {
|
||||
// do not start Elasticsearch twice
|
||||
return;
|
||||
if (container == null) {
|
||||
// Only start Elasticsearch once
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V6_8);
|
||||
client = HttpAsyncClients.createDefault();
|
||||
client.start();
|
||||
}
|
||||
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V6_8);
|
||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||
client = HttpAsyncClients.createDefault();
|
||||
client.start();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@@ -72,8 +69,10 @@ public class ElasticV6QueryChangesTest extends AbstractQueryChangesTest {
|
||||
.execute(
|
||||
new HttpPost(
|
||||
String.format(
|
||||
"http://localhost:%d/%s*/_close",
|
||||
nodeInfo.port, testName.getSanitizedMethodName())),
|
||||
"http://%s:%d/%s*/_close",
|
||||
container.getHttpHost().getHostName(),
|
||||
container.getHttpHost().getPort(),
|
||||
testName.getSanitizedMethodName())),
|
||||
HttpClientContext.create(),
|
||||
null)
|
||||
.get(5, MINUTES);
|
||||
@@ -90,7 +89,7 @@ public class ElasticV6QueryChangesTest extends AbstractQueryChangesTest {
|
||||
Config elasticsearchConfig = new Config(config);
|
||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||
String indicesPrefix = testName.getSanitizedMethodName();
|
||||
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
||||
ElasticTestUtils.configure(elasticsearchConfig, container, indicesPrefix);
|
||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
package com.google.gerrit.elasticsearch;
|
||||
|
||||
import com.google.gerrit.elasticsearch.ElasticTestUtils.ElasticNodeInfo;
|
||||
import com.google.gerrit.server.query.group.AbstractQueryGroupsTest;
|
||||
import com.google.gerrit.testing.ConfigSuite;
|
||||
import com.google.gerrit.testing.InMemoryModule;
|
||||
@@ -31,18 +30,14 @@ public class ElasticV6QueryGroupsTest extends AbstractQueryGroupsTest {
|
||||
return IndexConfig.createForElasticsearch();
|
||||
}
|
||||
|
||||
private static ElasticNodeInfo nodeInfo;
|
||||
private static ElasticContainer container;
|
||||
|
||||
@BeforeClass
|
||||
public static void startIndexService() {
|
||||
if (nodeInfo != null) {
|
||||
// do not start Elasticsearch twice
|
||||
return;
|
||||
if (container == null) {
|
||||
// Only start Elasticsearch once
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V6_8);
|
||||
}
|
||||
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V6_8);
|
||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@@ -63,7 +58,7 @@ public class ElasticV6QueryGroupsTest extends AbstractQueryGroupsTest {
|
||||
Config elasticsearchConfig = new Config(config);
|
||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||
String indicesPrefix = testName.getSanitizedMethodName();
|
||||
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
||||
ElasticTestUtils.configure(elasticsearchConfig, container, indicesPrefix);
|
||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
package com.google.gerrit.elasticsearch;
|
||||
|
||||
import com.google.gerrit.elasticsearch.ElasticTestUtils.ElasticNodeInfo;
|
||||
import com.google.gerrit.server.query.project.AbstractQueryProjectsTest;
|
||||
import com.google.gerrit.testing.ConfigSuite;
|
||||
import com.google.gerrit.testing.InMemoryModule;
|
||||
@@ -31,18 +30,14 @@ public class ElasticV6QueryProjectsTest extends AbstractQueryProjectsTest {
|
||||
return IndexConfig.createForElasticsearch();
|
||||
}
|
||||
|
||||
private static ElasticNodeInfo nodeInfo;
|
||||
private static ElasticContainer container;
|
||||
|
||||
@BeforeClass
|
||||
public static void startIndexService() {
|
||||
if (nodeInfo != null) {
|
||||
// do not start Elasticsearch twice
|
||||
return;
|
||||
if (container == null) {
|
||||
// Only start Elasticsearch once
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V6_8);
|
||||
}
|
||||
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V6_8);
|
||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@@ -63,7 +58,7 @@ public class ElasticV6QueryProjectsTest extends AbstractQueryProjectsTest {
|
||||
Config elasticsearchConfig = new Config(config);
|
||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||
String indicesPrefix = testName.getSanitizedMethodName();
|
||||
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
||||
ElasticTestUtils.configure(elasticsearchConfig, container, indicesPrefix);
|
||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
package com.google.gerrit.elasticsearch;
|
||||
|
||||
import com.google.gerrit.elasticsearch.ElasticTestUtils.ElasticNodeInfo;
|
||||
import com.google.gerrit.server.query.account.AbstractQueryAccountsTest;
|
||||
import com.google.gerrit.testing.ConfigSuite;
|
||||
import com.google.gerrit.testing.InMemoryModule;
|
||||
@@ -31,18 +30,14 @@ public class ElasticV7QueryAccountsTest extends AbstractQueryAccountsTest {
|
||||
return IndexConfig.createForElasticsearch();
|
||||
}
|
||||
|
||||
private static ElasticNodeInfo nodeInfo;
|
||||
private static ElasticContainer container;
|
||||
|
||||
@BeforeClass
|
||||
public static void startIndexService() {
|
||||
if (nodeInfo != null) {
|
||||
// do not start Elasticsearch twice
|
||||
return;
|
||||
if (container == null) {
|
||||
// Only start Elasticsearch once
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V7_6);
|
||||
}
|
||||
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V7_6);
|
||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@@ -63,7 +58,7 @@ public class ElasticV7QueryAccountsTest extends AbstractQueryAccountsTest {
|
||||
Config elasticsearchConfig = new Config(config);
|
||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||
String indicesPrefix = testName.getSanitizedMethodName();
|
||||
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
||||
ElasticTestUtils.configure(elasticsearchConfig, container, indicesPrefix);
|
||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ 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;
|
||||
import com.google.gerrit.testing.GerritTestName;
|
||||
@@ -32,29 +31,27 @@ import org.eclipse.jgit.lib.Config;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
|
||||
@Ignore("Tests failing because of the attention-set changes, see Issue 12524")
|
||||
public class ElasticV7QueryChangesTest extends AbstractQueryChangesTest {
|
||||
@ConfigSuite.Default
|
||||
public static Config defaultConfig() {
|
||||
return IndexConfig.createForElasticsearch();
|
||||
}
|
||||
|
||||
private static ElasticNodeInfo nodeInfo;
|
||||
private static ElasticContainer container;
|
||||
private static CloseableHttpAsyncClient client;
|
||||
|
||||
@BeforeClass
|
||||
public static void startIndexService() {
|
||||
if (nodeInfo != null) {
|
||||
// do not start Elasticsearch twice
|
||||
return;
|
||||
if (container == null) {
|
||||
// Only start Elasticsearch once
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V7_6);
|
||||
client = HttpAsyncClients.createDefault();
|
||||
client.start();
|
||||
}
|
||||
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V7_6);
|
||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||
client = HttpAsyncClients.createDefault();
|
||||
client.start();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@@ -72,8 +69,10 @@ public class ElasticV7QueryChangesTest extends AbstractQueryChangesTest {
|
||||
.execute(
|
||||
new HttpPost(
|
||||
String.format(
|
||||
"http://localhost:%d/%s*/_close",
|
||||
nodeInfo.port, testName.getSanitizedMethodName())),
|
||||
"http://%s:%d/%s*/_close",
|
||||
container.getHttpHost().getHostName(),
|
||||
container.getHttpHost().getPort(),
|
||||
testName.getSanitizedMethodName())),
|
||||
HttpClientContext.create(),
|
||||
null)
|
||||
.get(5, MINUTES);
|
||||
@@ -90,7 +89,7 @@ public class ElasticV7QueryChangesTest extends AbstractQueryChangesTest {
|
||||
Config elasticsearchConfig = new Config(config);
|
||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||
String indicesPrefix = testName.getSanitizedMethodName();
|
||||
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
||||
ElasticTestUtils.configure(elasticsearchConfig, container, indicesPrefix);
|
||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
package com.google.gerrit.elasticsearch;
|
||||
|
||||
import com.google.gerrit.elasticsearch.ElasticTestUtils.ElasticNodeInfo;
|
||||
import com.google.gerrit.server.query.group.AbstractQueryGroupsTest;
|
||||
import com.google.gerrit.testing.ConfigSuite;
|
||||
import com.google.gerrit.testing.InMemoryModule;
|
||||
@@ -31,18 +30,14 @@ public class ElasticV7QueryGroupsTest extends AbstractQueryGroupsTest {
|
||||
return IndexConfig.createForElasticsearch();
|
||||
}
|
||||
|
||||
private static ElasticNodeInfo nodeInfo;
|
||||
private static ElasticContainer container;
|
||||
|
||||
@BeforeClass
|
||||
public static void startIndexService() {
|
||||
if (nodeInfo != null) {
|
||||
// do not start Elasticsearch twice
|
||||
return;
|
||||
if (container == null) {
|
||||
// Only start Elasticsearch once
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V7_6);
|
||||
}
|
||||
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V7_6);
|
||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@@ -63,7 +58,7 @@ public class ElasticV7QueryGroupsTest extends AbstractQueryGroupsTest {
|
||||
Config elasticsearchConfig = new Config(config);
|
||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||
String indicesPrefix = testName.getSanitizedMethodName();
|
||||
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
||||
ElasticTestUtils.configure(elasticsearchConfig, container, indicesPrefix);
|
||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
package com.google.gerrit.elasticsearch;
|
||||
|
||||
import com.google.gerrit.elasticsearch.ElasticTestUtils.ElasticNodeInfo;
|
||||
import com.google.gerrit.server.query.project.AbstractQueryProjectsTest;
|
||||
import com.google.gerrit.testing.ConfigSuite;
|
||||
import com.google.gerrit.testing.InMemoryModule;
|
||||
@@ -31,18 +30,14 @@ public class ElasticV7QueryProjectsTest extends AbstractQueryProjectsTest {
|
||||
return IndexConfig.createForElasticsearch();
|
||||
}
|
||||
|
||||
private static ElasticNodeInfo nodeInfo;
|
||||
private static ElasticContainer container;
|
||||
|
||||
@BeforeClass
|
||||
public static void startIndexService() {
|
||||
if (nodeInfo != null) {
|
||||
// do not start Elasticsearch twice
|
||||
return;
|
||||
if (container == null) {
|
||||
// Only start Elasticsearch once
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V7_6);
|
||||
}
|
||||
|
||||
container = ElasticContainer.createAndStart(ElasticVersion.V7_6);
|
||||
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@@ -63,7 +58,7 @@ public class ElasticV7QueryProjectsTest extends AbstractQueryProjectsTest {
|
||||
Config elasticsearchConfig = new Config(config);
|
||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||
String indicesPrefix = testName.getSanitizedMethodName();
|
||||
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
||||
ElasticTestUtils.configure(elasticsearchConfig, container, indicesPrefix);
|
||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user