Tests: Forward port tweak to prepareBackwardsDataDir to 1.x to allow passing
settings when loading an old index.
This commit is contained in:
parent
4f225007f0
commit
a0b7e5842d
|
@ -46,10 +46,10 @@ import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
|||
@ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numDataNodes = 0, minNumDataNodes = 0, maxNumDataNodes = 0)
|
||||
public class StaticIndexBackwardCompatibilityTest extends ElasticsearchIntegrationTest {
|
||||
|
||||
public void loadIndex(String index) throws Exception {
|
||||
public void loadIndex(String index, Object... settings) throws Exception {
|
||||
logger.info("Checking static index " + index);
|
||||
Settings settings = prepareBackwardsDataDir(new File(getClass().getResource(index).toURI()));
|
||||
internalCluster().startNode(settings);
|
||||
Settings nodeSettings = prepareBackwardsDataDir(new File(getClass().getResource(index).toURI()), settings);
|
||||
internalCluster().startNode(nodeSettings);
|
||||
ensureGreen("test");
|
||||
assertIndexSanity();
|
||||
}
|
||||
|
|
|
@ -1865,7 +1865,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
/**
|
||||
* Return settings that could be used to start a node that has the given zipped home directory.
|
||||
*/
|
||||
protected Settings prepareBackwardsDataDir(File backwardsIndex) throws IOException {
|
||||
protected Settings prepareBackwardsDataDir(File backwardsIndex, Object... settings) throws IOException {
|
||||
File indexDir = newTempDir();
|
||||
File dataDir = new File(indexDir, "data");
|
||||
try (FileInputStream stream = new FileInputStream(backwardsIndex)) {
|
||||
|
@ -1883,6 +1883,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
assertFalse(src.exists());
|
||||
assertTrue(dest.exists());
|
||||
ImmutableSettings.Builder builder = ImmutableSettings.builder()
|
||||
.put(settings)
|
||||
.put("gateway.type", "local") // this is important we need to recover from gateway
|
||||
.put("path.data", dataDir.getPath());
|
||||
|
||||
|
|
Loading…
Reference in New Issue