Tests: Add memory info to static bwc index tests.

This commit is contained in:
Ryan Ernst 2015-01-23 13:19:33 -08:00
parent f95fa83e5b
commit 54d01c48cb
2 changed files with 9 additions and 0 deletions

View File

@ -126,6 +126,7 @@ public class OldIndexBackwardsCompatibilityTests extends StaticIndexBackwardComp
public void testOldIndexes() throws Exception {
Collections.shuffle(indexes, getRandom());
for (String index : indexes) {
logMemoryStats();
logger.info("Testing old index " + index);
assertOldIndexWorks(index);
}

View File

@ -86,6 +86,7 @@ import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.common.xcontent.json.JsonXContent;
import org.elasticsearch.common.xcontent.support.XContentMapValues;
import org.elasticsearch.discovery.zen.elect.ElectMasterService;
@ -1091,6 +1092,13 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
segsRsp.toXContent(JsonXContent.contentBuilder().prettyPrint(), ToXContent.EMPTY_PARAMS).string());
}
/**
* Prints current memory stats as info logging.
*/
public void logMemoryStats() {
logger.info("memory: {}", XContentHelper.toString(client().admin().cluster().prepareNodesStats().clear().setJvm(true).get()));
}
void ensureClusterSizeConsistency() {
if (cluster() != null) { // if static init fails the cluster can be null
logger.trace("Check consistency for [{}] nodes", cluster().size());