From a64f9afa30530e989527504d9ea7ce28080ff72b Mon Sep 17 00:00:00 2001 From: Alexander Reelsen Date: Wed, 19 Jul 2017 16:11:03 +0200 Subject: [PATCH] Tests: Ensure correct client is picked when security is enabled Original commit: elastic/x-pack-elasticsearch@67d05553f85db05d5d10005f738cfc0d2e0c3938 --- .../watcher/transport/action/stats/OldWatcherStatsTests.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/transport/action/stats/OldWatcherStatsTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/transport/action/stats/OldWatcherStatsTests.java index 4ae4236d106..79c5aa33604 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/transport/action/stats/OldWatcherStatsTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/transport/action/stats/OldWatcherStatsTests.java @@ -5,6 +5,7 @@ */ package org.elasticsearch.xpack.watcher.transport.action.stats; +import org.elasticsearch.client.Client; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; import org.elasticsearch.xpack.watcher.transport.actions.stats.OldWatcherStatsAction; import org.elasticsearch.xpack.watcher.transport.actions.stats.OldWatcherStatsRequest; @@ -17,7 +18,8 @@ public class OldWatcherStatsTests extends AbstractWatcherIntegrationTestCase { // these stats are not exposed in the watcherclient as they are only needed for the rolling upgrade public void testPre6xWatcherStats() throws Exception { - OldWatcherStatsResponse response = client().execute(OldWatcherStatsAction.INSTANCE, new OldWatcherStatsRequest()).actionGet(); + Client client = securityEnabled() ? internalCluster().transportClient() : client(); + OldWatcherStatsResponse response = client.execute(OldWatcherStatsAction.INSTANCE, new OldWatcherStatsRequest()).actionGet(); assertThat(response.getThreadPoolMaxSize(), is(greaterThanOrEqualTo(0L))); assertThat(response.getThreadPoolQueueSize(), is(greaterThanOrEqualTo(0L))); assertThat(response.getWatchesCount(), is(greaterThanOrEqualTo(0L)));