From 3aa76795f996adaa497cd7f3efee77be753be07c Mon Sep 17 00:00:00 2001 From: Tanguy Leroux Date: Thu, 12 Nov 2015 14:11:26 +0100 Subject: [PATCH 1/2] Marvel: Ensure ClusterStatsTests waits enough for marvel documents The should wait a bit more and refreshes index between each assertBusy() Closes elastic/elasticsearch#729 Original commit: elastic/x-pack-elasticsearch@8ec702c1dc11d125b446b64b75454b0a90d45a52 --- .../agent/renderer/cluster/ClusterStatsTests.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStatsTests.java b/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStatsTests.java index 537c3991cea..523ceed3337 100644 --- a/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStatsTests.java +++ b/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/cluster/ClusterStatsTests.java @@ -9,6 +9,7 @@ import org.elasticsearch.action.admin.cluster.stats.ClusterStatsNodes; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.marvel.agent.collector.cluster.ClusterStatsCollector; +import org.elasticsearch.marvel.agent.collector.indices.IndexStatsCollector; import org.elasticsearch.marvel.agent.settings.MarvelSettings; import org.elasticsearch.marvel.test.MarvelIntegTestCase; import org.elasticsearch.search.SearchHit; @@ -62,16 +63,13 @@ public class ClusterStatsTests extends MarvelIntegTestCase { // ok.. we'll start collecting now... updateMarvelInterval(3L, TimeUnit.SECONDS); - awaitMarvelTemplateInstalled(); + awaitMarvelDocsCount(greaterThan(0L), ClusterStatsCollector.TYPE); assertBusy(new Runnable() { @Override public void run() { - logger.debug("--> searching for marvel [{}] documents", ClusterStatsCollector.TYPE); - SearchResponse response = client().prepareSearch().setTypes(ClusterStatsCollector.TYPE).get(); - assertThat(response.getHits().getTotalHits(), greaterThan(0L)); - logger.debug("--> checking that every document contains the expected fields"); + SearchResponse response = client().prepareSearch().setTypes(ClusterStatsCollector.TYPE).get(); String[] filters = ClusterStatsRenderer.FILTERS; for (SearchHit searchHit : response.getHits().getHits()) { Map fields = searchHit.sourceAsMap(); @@ -80,9 +78,9 @@ public class ClusterStatsTests extends MarvelIntegTestCase { assertContains(filter, fields); } } - - logger.debug("--> cluster stats successfully collected"); } }); + + logger.debug("--> cluster stats successfully collected"); } } From 557f0d4f8364ecce451e16b5c98b171147af9e74 Mon Sep 17 00:00:00 2001 From: Lee Hinman Date: Fri, 13 Nov 2015 09:35:46 -0700 Subject: [PATCH 2/2] Fix compilation for `newIndexSettings` arity change Original commit: elastic/x-pack-elasticsearch@f94fabfcc9ecec828630b09c0c1a147a5dafa17e --- .../shield/authz/accesscontrol/DocumentSubsetReaderTests.java | 4 ++-- .../ShieldIndexSearcherWrapperIntegrationTests.java | 4 ++-- .../accesscontrol/ShieldIndexSearcherWrapperUnitTests.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/shield/src/test/java/org/elasticsearch/shield/authz/accesscontrol/DocumentSubsetReaderTests.java b/shield/src/test/java/org/elasticsearch/shield/authz/accesscontrol/DocumentSubsetReaderTests.java index 0149ff8efd6..26ffdb789b7 100644 --- a/shield/src/test/java/org/elasticsearch/shield/authz/accesscontrol/DocumentSubsetReaderTests.java +++ b/shield/src/test/java/org/elasticsearch/shield/authz/accesscontrol/DocumentSubsetReaderTests.java @@ -42,7 +42,7 @@ public class DocumentSubsetReaderTests extends ESTestCase { @Before public void before() { directory = newDirectory(); - IndexSettings settings = IndexSettingsModule.newIndexSettings(new Index("_index"), Settings.EMPTY, Collections.EMPTY_LIST); + IndexSettings settings = IndexSettingsModule.newIndexSettings(new Index("_index"), Settings.EMPTY); bitsetFilterCache = new BitsetFilterCache(settings, new IndicesWarmer(settings.getSettings(), null), new BitsetFilterCache.Listener() { @Override public void onCache(ShardId shardId, Accountable accountable) { @@ -157,7 +157,7 @@ public class DocumentSubsetReaderTests extends ESTestCase { IndexWriterConfig iwc = new IndexWriterConfig(null); IndexWriter iw = new IndexWriter(dir, iwc); iw.close(); - IndexSettings settings = IndexSettingsModule.newIndexSettings(new Index("_index"), Settings.EMPTY, Collections.EMPTY_LIST); + IndexSettings settings = IndexSettingsModule.newIndexSettings(new Index("_index"), Settings.EMPTY); BitsetFilterCache bitsetFilterCache = new BitsetFilterCache(settings, new IndicesWarmer(settings.getSettings(), null), new BitsetFilterCache.Listener() { @Override public void onCache(ShardId shardId, Accountable accountable) { diff --git a/shield/src/test/java/org/elasticsearch/shield/authz/accesscontrol/ShieldIndexSearcherWrapperIntegrationTests.java b/shield/src/test/java/org/elasticsearch/shield/authz/accesscontrol/ShieldIndexSearcherWrapperIntegrationTests.java index f1ecc7483b5..001cb715745 100644 --- a/shield/src/test/java/org/elasticsearch/shield/authz/accesscontrol/ShieldIndexSearcherWrapperIntegrationTests.java +++ b/shield/src/test/java/org/elasticsearch/shield/authz/accesscontrol/ShieldIndexSearcherWrapperIntegrationTests.java @@ -80,9 +80,9 @@ public class ShieldIndexSearcherWrapperIntegrationTests extends ESTestCase { RequestContext.setCurrent(new RequestContext(request)); IndicesAccessControl.IndexAccessControl indexAccessControl = new IndicesAccessControl.IndexAccessControl(true, null, singleton(new BytesArray("{}"))); request.putInContext(InternalAuthorizationService.INDICES_PERMISSIONS_KEY, new IndicesAccessControl(true, singletonMap("_index", indexAccessControl))); - IndexSettings indexSettings = IndexSettingsModule.newIndexSettings(shardId.index(), Settings.EMPTY, Collections.EMPTY_LIST); + IndexSettings indexSettings = IndexSettingsModule.newIndexSettings(shardId.index(), Settings.EMPTY); QueryShardContext queryShardContext = mock(QueryShardContext.class); - IndexSettings settings = IndexSettingsModule.newIndexSettings(new Index("_index"), Settings.EMPTY, Collections.EMPTY_LIST); + IndexSettings settings = IndexSettingsModule.newIndexSettings(new Index("_index"), Settings.EMPTY); BitsetFilterCache bitsetFilterCache = new BitsetFilterCache(settings, new IndicesWarmer(settings.getSettings(), null), new BitsetFilterCache.Listener() { @Override public void onCache(ShardId shardId, Accountable accountable) { diff --git a/shield/src/test/java/org/elasticsearch/shield/authz/accesscontrol/ShieldIndexSearcherWrapperUnitTests.java b/shield/src/test/java/org/elasticsearch/shield/authz/accesscontrol/ShieldIndexSearcherWrapperUnitTests.java index 24143f29380..785b7e20ed3 100644 --- a/shield/src/test/java/org/elasticsearch/shield/authz/accesscontrol/ShieldIndexSearcherWrapperUnitTests.java +++ b/shield/src/test/java/org/elasticsearch/shield/authz/accesscontrol/ShieldIndexSearcherWrapperUnitTests.java @@ -63,7 +63,7 @@ public class ShieldIndexSearcherWrapperUnitTests extends ESTestCase { @Before public void before() throws Exception { Index index = new Index("_index"); - IndexSettings indexSettings = IndexSettingsModule.newIndexSettings(index, Settings.EMPTY, Collections.emptyList()); + IndexSettings indexSettings = IndexSettingsModule.newIndexSettings(index, Settings.EMPTY); AnalysisService analysisService = new AnalysisService(indexSettings, Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap()); SimilarityService similarityService = new SimilarityService(indexSettings, Collections.emptyMap()); @@ -224,7 +224,7 @@ public class ShieldIndexSearcherWrapperUnitTests extends ESTestCase { public void testDelegateSimilarity() throws Exception { ShardId shardId = new ShardId("_index", 0); - IndexSettings settings = IndexSettingsModule.newIndexSettings(new Index("_index"), Settings.EMPTY, Collections.emptyList()); + IndexSettings settings = IndexSettingsModule.newIndexSettings(new Index("_index"), Settings.EMPTY); BitsetFilterCache bitsetFilterCache = new BitsetFilterCache(settings, new IndicesWarmer(settings.getSettings(), null), new BitsetFilterCache.Listener() { @Override public void onCache(ShardId shardId, Accountable accountable) {