GerritServer: save gerrit.config before site init
Do so as already done in 2.15 and master versions. Fix ElasticReindexIT so it passes also with this change. Contrary to Lucene, configuring the Elasticsearch index type currently assumes uninitialized indices -in Elasticsearch. Thus fix the test so it first asserts that assumption, then reindexes or initializes indices offline. The test then keeps testing as currently the case also for ReindexIT, i.e., through their common parent test class methods. Bug: Issue 8799 Change-Id: Ie52ea03a781c89fb3caf0f965f6fca1fb6c6a478
This commit is contained in:
parent
9e1c00736d
commit
108ad65a76
@ -185,6 +185,15 @@ public class GerritServer implements AutoCloseable {
|
|||||||
checkArgument(!desc.memory(), "can't initialize site path for in-memory test: %s", desc);
|
checkArgument(!desc.memory(), "can't initialize site path for in-memory test: %s", desc);
|
||||||
Config cfg = desc.buildConfig(baseConfig);
|
Config cfg = desc.buildConfig(baseConfig);
|
||||||
Map<String, Config> pluginConfigs = desc.buildPluginConfigs();
|
Map<String, Config> pluginConfigs = desc.buildPluginConfigs();
|
||||||
|
|
||||||
|
MergeableFileBasedConfig gerritConfig =
|
||||||
|
new MergeableFileBasedConfig(
|
||||||
|
site.resolve("etc").resolve("gerrit.config").toFile(), FS.DETECTED);
|
||||||
|
gerritConfig.load();
|
||||||
|
gerritConfig.merge(cfg);
|
||||||
|
mergeTestConfig(gerritConfig);
|
||||||
|
gerritConfig.save();
|
||||||
|
|
||||||
Init init = new Init();
|
Init init = new Init();
|
||||||
int rc =
|
int rc =
|
||||||
init.main(
|
init.main(
|
||||||
@ -195,14 +204,6 @@ public class GerritServer implements AutoCloseable {
|
|||||||
throw new RuntimeException("Couldn't initialize site");
|
throw new RuntimeException("Couldn't initialize site");
|
||||||
}
|
}
|
||||||
|
|
||||||
MergeableFileBasedConfig gerritConfig =
|
|
||||||
new MergeableFileBasedConfig(
|
|
||||||
site.resolve("etc").resolve("gerrit.config").toFile(), FS.DETECTED);
|
|
||||||
gerritConfig.load();
|
|
||||||
gerritConfig.merge(cfg);
|
|
||||||
mergeTestConfig(gerritConfig);
|
|
||||||
gerritConfig.save();
|
|
||||||
|
|
||||||
for (String pluginName : pluginConfigs.keySet()) {
|
for (String pluginName : pluginConfigs.keySet()) {
|
||||||
MergeableFileBasedConfig pluginCfg =
|
MergeableFileBasedConfig pluginCfg =
|
||||||
new MergeableFileBasedConfig(
|
new MergeableFileBasedConfig(
|
||||||
|
@ -23,6 +23,7 @@ import com.google.inject.Injector;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import org.eclipse.jgit.lib.Config;
|
import org.eclipse.jgit.lib.Config;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
|
||||||
public class ElasticReindexIT extends AbstractReindexTests {
|
public class ElasticReindexIT extends AbstractReindexTests {
|
||||||
private static ElasticContainer<?> container;
|
private static ElasticContainer<?> container;
|
||||||
@ -62,6 +63,12 @@ public class ElasticReindexIT extends AbstractReindexTests {
|
|||||||
ElasticTestUtils.createAllIndexes(injector);
|
ElasticTestUtils.createAllIndexes(injector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void reindexFirstSinceElastic() throws Exception {
|
||||||
|
assertServerStartupFails();
|
||||||
|
runGerrit("reindex", "-d", sitePaths.site_path.toString(), "--show-stack-trace");
|
||||||
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void stopElasticServer() {
|
public void stopElasticServer() {
|
||||||
if (container != null) {
|
if (container != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user