ElasticReindexIT: add indices initialization prior

Make ElasticReindexIT pass. 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.

Align ElasticReindexIT with ElasticIndexIT, in terms of not stopping any
containers. Stopping them broke ElasticReindexIT in stable-2.15, out of
refused connection exceptions. This was likely because each container is
already being stopped or exited, so stopping/closing them again failed.
Containers are still explicitly closed in stable-2.14; still working for
the latter version.

Remove the flaky tag as ElasticReindexIT is now passing. This is also
why the stable-2.15 branch needs its own change, beside the potentially
merged-up Ie52ea03a. That flaky tag cannot currently be removed in
master though, as the latter still has Issue 9252 -for Elasticsearch V6.

Bug: Issue 8799
Change-Id: Ia90970544045ad9a0ddbd135d2196f70f1a83248
This commit is contained in:
Marco Miller 2018-07-19 12:23:22 -04:00
parent 570afa5c03
commit 5a83c4735e
2 changed files with 6 additions and 10 deletions

View File

@ -20,7 +20,6 @@ acceptance_tests(
"docker",
"elastic",
"exclusive",
"flaky",
"pgm",
],
deps = [

View File

@ -22,14 +22,13 @@ import com.google.gerrit.testutil.ConfigSuite;
import com.google.inject.Injector;
import java.util.UUID;
import org.eclipse.jgit.lib.Config;
import org.junit.After;
import org.junit.Before;
public class ElasticReindexIT extends AbstractReindexTests {
private static ElasticContainer<?> container;
private static Config getConfig(ElasticVersion version) {
ElasticNodeInfo elasticNodeInfo;
container = ElasticContainer.createAndStart(version);
ElasticContainer<?> container = ElasticContainer.createAndStart(version);
elasticNodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
String indicesPrefix = UUID.randomUUID().toString();
Config cfg = new Config();
@ -62,11 +61,9 @@ public class ElasticReindexIT extends AbstractReindexTests {
ElasticTestUtils.createAllIndexes(injector);
}
@After
public void stopElasticServer() {
if (container != null) {
container.stop();
container = null;
}
@Before
public void reindexFirstSinceElastic() throws Exception {
assertServerStartupFails();
runGerrit("reindex", "-d", sitePaths.site_path.toString(), "--show-stack-trace");
}
}