Merge branch 'stable-2.14' into stable-2.15
* stable-2.14: Add more debug logging to account creation Delete index after each test in elasticsearch tests Change-Id: I65516500727e1fea53dce5ee41ca7f62de247632
This commit is contained in:
@@ -21,6 +21,7 @@ import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import org.eclipse.jgit.lib.Config;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
@@ -45,11 +46,22 @@ public class ElasticQueryAccountsTest extends AbstractQueryAccountsTest {
|
||||
}
|
||||
}
|
||||
|
||||
private String testName() {
|
||||
return testName.getMethodName().toLowerCase() + "_";
|
||||
}
|
||||
|
||||
@After
|
||||
public void cleanupIndex() {
|
||||
if (nodeInfo != null) {
|
||||
ElasticTestUtils.deleteAllIndexes(nodeInfo, testName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Injector createInjector() {
|
||||
Config elasticsearchConfig = new Config(config);
|
||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||
String indicesPrefix = testName.getMethodName().toLowerCase() + "_";
|
||||
String indicesPrefix = testName();
|
||||
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
||||
ElasticTestUtils.createAllIndexes(nodeInfo, indicesPrefix);
|
||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
||||
|
@@ -23,6 +23,7 @@ import com.google.inject.Injector;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import org.eclipse.jgit.junit.TestRepository;
|
||||
import org.eclipse.jgit.lib.Config;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
@@ -48,11 +49,22 @@ public class ElasticQueryChangesTest extends AbstractQueryChangesTest {
|
||||
}
|
||||
}
|
||||
|
||||
private String testName() {
|
||||
return testName.getMethodName().toLowerCase() + "_";
|
||||
}
|
||||
|
||||
@After
|
||||
public void cleanupIndex() {
|
||||
if (nodeInfo != null) {
|
||||
ElasticTestUtils.deleteAllIndexes(nodeInfo, testName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Injector createInjector() {
|
||||
Config elasticsearchConfig = new Config(config);
|
||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||
String indicesPrefix = testName.getMethodName().toLowerCase() + "_";
|
||||
String indicesPrefix = testName();
|
||||
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
||||
ElasticTestUtils.createAllIndexes(nodeInfo, indicesPrefix);
|
||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
||||
|
@@ -21,6 +21,7 @@ import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import org.eclipse.jgit.lib.Config;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
@@ -45,11 +46,22 @@ public class ElasticQueryGroupsTest extends AbstractQueryGroupsTest {
|
||||
}
|
||||
}
|
||||
|
||||
private String testName() {
|
||||
return testName.getMethodName().toLowerCase() + "_";
|
||||
}
|
||||
|
||||
@After
|
||||
public void cleanupIndex() {
|
||||
if (nodeInfo != null) {
|
||||
ElasticTestUtils.deleteAllIndexes(nodeInfo, testName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Injector createInjector() {
|
||||
Config elasticsearchConfig = new Config(config);
|
||||
InMemoryModule.setDefaults(elasticsearchConfig);
|
||||
String indicesPrefix = testName.getMethodName().toLowerCase() + "_";
|
||||
String indicesPrefix = testName();
|
||||
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
|
||||
ElasticTestUtils.createAllIndexes(nodeInfo, indicesPrefix);
|
||||
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
|
||||
|
@@ -106,8 +106,36 @@ final class ElasticTestUtils {
|
||||
return new ElasticNodeInfo(node, elasticDir, getHttpPort(node));
|
||||
}
|
||||
|
||||
static void deleteAllIndexes(ElasticNodeInfo nodeInfo) {
|
||||
nodeInfo.node.client().admin().indices().prepareDelete("_all").execute();
|
||||
static void deleteAllIndexes(ElasticNodeInfo nodeInfo, String prefix) {
|
||||
Schema<ChangeData> changeSchema = ChangeSchemaDefinitions.INSTANCE.getLatest();
|
||||
nodeInfo
|
||||
.node
|
||||
.client()
|
||||
.admin()
|
||||
.indices()
|
||||
.prepareDelete(String.format("%s%s_%04d", prefix, CHANGES, changeSchema.getVersion()))
|
||||
.execute()
|
||||
.actionGet();
|
||||
|
||||
Schema<AccountState> accountSchema = AccountSchemaDefinitions.INSTANCE.getLatest();
|
||||
nodeInfo
|
||||
.node
|
||||
.client()
|
||||
.admin()
|
||||
.indices()
|
||||
.prepareDelete(String.format("%s%s_%04d", prefix, ACCOUNTS, accountSchema.getVersion()))
|
||||
.execute()
|
||||
.actionGet();
|
||||
|
||||
Schema<InternalGroup> groupSchema = GroupSchemaDefinitions.INSTANCE.getLatest();
|
||||
nodeInfo
|
||||
.node
|
||||
.client()
|
||||
.admin()
|
||||
.indices()
|
||||
.prepareDelete(String.format("%s%s_%04d", prefix, GROUPS, groupSchema.getVersion()))
|
||||
.execute()
|
||||
.actionGet();
|
||||
}
|
||||
|
||||
static class NodeInfo {
|
||||
|
Reference in New Issue
Block a user