From 54d01c48cb204f273595518f19c1cfb255b41de7 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Fri, 23 Jan 2015 13:19:33 -0800 Subject: [PATCH] Tests: Add memory info to static bwc index tests. --- .../bwcompat/OldIndexBackwardsCompatibilityTests.java | 1 + .../elasticsearch/test/ElasticsearchIntegrationTest.java | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/test/java/org/elasticsearch/bwcompat/OldIndexBackwardsCompatibilityTests.java b/src/test/java/org/elasticsearch/bwcompat/OldIndexBackwardsCompatibilityTests.java index 472e07883ea..da2171da1ff 100644 --- a/src/test/java/org/elasticsearch/bwcompat/OldIndexBackwardsCompatibilityTests.java +++ b/src/test/java/org/elasticsearch/bwcompat/OldIndexBackwardsCompatibilityTests.java @@ -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); } diff --git a/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java b/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java index 203c5841a21..25eced8f6b5 100644 --- a/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java +++ b/src/test/java/org/elasticsearch/test/ElasticsearchIntegrationTest.java @@ -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());