Disable random ram directories to prevent OOM during tests.

We need to find a way to enable this without adding crazy heaps etc.
Maybe only selected tests can run this.
This commit is contained in:
Simon Willnauer 2013-09-18 08:26:51 +02:00
parent 81bd1f9fd2
commit 80b7377b29
2 changed files with 5 additions and 4 deletions

View File

@ -41,7 +41,6 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.store.mock.MockFSIndexStoreModule;
import org.elasticsearch.index.store.mock.MockRamIndexStoreModule;
import org.elasticsearch.node.Node;
import org.elasticsearch.node.internal.InternalNode;
import org.elasticsearch.transport.TransportService;
@ -113,7 +112,8 @@ public class TestCluster {
}
this.defaultSettings = ImmutableSettings.settingsBuilder()
/* use RAM directories in 10% of the runs */
.put("index.store.type", random.nextInt(10) == 0 ? MockRamIndexStoreModule.class.getName() : MockFSIndexStoreModule.class.getName())
// .put("index.store.type", random.nextInt(10) == 0 ? MockRamIndexStoreModule.class.getName() : MockFSIndexStoreModule.class.getName())
.put("index.store.type", MockFSIndexStoreModule.class.getName()) // no RAM dir for now!
.put(defaultSettings)
.put("cluster.name", clusterName).build();
}
@ -363,6 +363,7 @@ public class TestCluster {
}
nextNodeId.set(sharedNodesSeeds.length);
assert numNodes() == sharedNodesSeeds.length;
client().admin().cluster().prepareHealth().setWaitForNodes(Integer.toString(sharedNodesSeeds.length)).get();
}
private void resetClients() {

View File

@ -59,8 +59,8 @@ public class SearchPreferenceTests extends AbstractSharedClusterTest {
@Test
public void noPreferenceRandom() throws Exception {
client().admin().indices().prepareCreate("test").setSettings(settingsBuilder().put("index.number_of_shards", 1).put("index.number_of_replicas", 1)).execute().actionGet();
client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet();
ensureGreen();
client().prepareIndex("test", "type1").setSource("field1", "value1").execute().actionGet();
client().admin().indices().prepareRefresh().execute().actionGet();