Elasticsearch: Unharcode localhost for container's

No longer hardcode the docker container hostname for the Elasticsearch
tests. Use the hostname that was dynamically resolved from the running
ElasticContainer (the 'testcontainer') instead.

This is so that tests running upon non-localhost named containers may
pass like in the localhost case.

Change-Id: I9dbd8b76bd7b22004d1d2327bb4c8395907ff223
This commit is contained in:
Marco Miller
2020-04-01 14:18:29 -04:00
parent 7d59b457f8
commit 22aa30d2c3
13 changed files with 68 additions and 32 deletions

View File

@@ -42,7 +42,9 @@ public class ElasticV6QueryProjectsTest extends AbstractQueryProjectsTest {
}
container = ElasticContainer.createAndStart(ElasticVersion.V6_8);
nodeInfo = new ElasticNodeInfo(container.getHttpHost().getPort());
nodeInfo =
new ElasticNodeInfo(
container.getHttpHost().getHostName(), container.getHttpHost().getPort());
}
@AfterClass
@@ -63,7 +65,8 @@ public class ElasticV6QueryProjectsTest extends AbstractQueryProjectsTest {
Config elasticsearchConfig = new Config(config);
InMemoryModule.setDefaults(elasticsearchConfig);
String indicesPrefix = getSanitizedMethodName();
ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port, indicesPrefix);
ElasticTestUtils.configure(
elasticsearchConfig, nodeInfo.hostname, nodeInfo.port, indicesPrefix);
return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
}
}