Merge remote-tracking branch 'dakrone/freebsd-test-fix'

This commit is contained in:
Lee Hinman 2015-12-22 15:41:35 -07:00
commit 862cdad8dc
4 changed files with 37 additions and 10 deletions

View File

@ -20,6 +20,7 @@
package org.elasticsearch.monitor.jvm; package org.elasticsearch.monitor.jvm;
import org.apache.lucene.util.CollectionUtil; import org.apache.lucene.util.CollectionUtil;
import org.apache.lucene.util.Constants;
import org.elasticsearch.common.joda.FormatDateTimeFormatter; import org.elasticsearch.common.joda.FormatDateTimeFormatter;
import org.elasticsearch.common.joda.Joda; import org.elasticsearch.common.joda.Joda;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
@ -131,6 +132,11 @@ public class HotThreads {
private String innerDetect() throws Exception { private String innerDetect() throws Exception {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (Constants.FREE_BSD) {
sb.append("hot_threads is not supported on FreeBSD");
return sb.toString();
}
sb.append("Hot threads at "); sb.append("Hot threads at ");
sb.append(DATE_TIME_FORMATTER.printer().print(System.currentTimeMillis())); sb.append(DATE_TIME_FORMATTER.printer().print(System.currentTimeMillis()));
sb.append(", interval="); sb.append(", interval=");

View File

@ -18,6 +18,7 @@
*/ */
package org.elasticsearch.action.admin; package org.elasticsearch.action.admin;
import org.apache.lucene.util.Constants;
import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.cluster.node.hotthreads.NodeHotThreads; import org.elasticsearch.action.admin.cluster.node.hotthreads.NodeHotThreads;
import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsRequestBuilder; import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsRequestBuilder;
@ -40,6 +41,7 @@ import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.Matchers.lessThan; import static org.hamcrest.Matchers.lessThan;
public class HotThreadsIT extends ESIntegTestCase { public class HotThreadsIT extends ESIntegTestCase {
public void testHotThreadsDontFail() throws ExecutionException, InterruptedException { public void testHotThreadsDontFail() throws ExecutionException, InterruptedException {
/** /**
* This test just checks if nothing crashes or gets stuck etc. * This test just checks if nothing crashes or gets stuck etc.
@ -125,6 +127,7 @@ public class HotThreadsIT extends ESIntegTestCase {
} }
public void testIgnoreIdleThreads() throws ExecutionException, InterruptedException { public void testIgnoreIdleThreads() throws ExecutionException, InterruptedException {
assumeTrue("no support for hot_threads on FreeBSD", Constants.FREE_BSD == false);
// First time, don't ignore idle threads: // First time, don't ignore idle threads:
NodesHotThreadsRequestBuilder builder = client().admin().cluster().prepareNodesHotThreads(); NodesHotThreadsRequestBuilder builder = client().admin().cluster().prepareNodesHotThreads();
@ -158,6 +161,12 @@ public class HotThreadsIT extends ESIntegTestCase {
NodesHotThreadsResponse response = client().admin().cluster().prepareNodesHotThreads().execute().get(); NodesHotThreadsResponse response = client().admin().cluster().prepareNodesHotThreads().execute().get();
if (Constants.FREE_BSD) {
for (NodeHotThreads node : response.getNodesMap().values()) {
String result = node.getHotThreads();
assertTrue(result.indexOf("hot_threads is not supported") != -1);
}
} else {
for (NodeHotThreads node : response.getNodesMap().values()) { for (NodeHotThreads node : response.getNodesMap().values()) {
String result = node.getHotThreads(); String result = node.getHotThreads();
assertTrue(result.indexOf("Hot threads at") != -1); assertTrue(result.indexOf("Hot threads at") != -1);
@ -166,4 +175,5 @@ public class HotThreadsIT extends ESIntegTestCase {
assertTrue(result.indexOf("ignoreIdleThreads=true") != -1); assertTrue(result.indexOf("ignoreIdleThreads=true") != -1);
} }
} }
}
} }

View File

@ -19,6 +19,7 @@
package org.elasticsearch.plugin.discovery.multicast; package org.elasticsearch.plugin.discovery.multicast;
import org.apache.lucene.util.Constants;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNode;
@ -45,6 +46,7 @@ import java.net.InetAddress;
import java.net.MulticastSocket; import java.net.MulticastSocket;
public class MulticastZenPingTests extends ESTestCase { public class MulticastZenPingTests extends ESTestCase {
private Settings buildRandomMulticast(Settings settings) { private Settings buildRandomMulticast(Settings settings) {
Settings.Builder builder = Settings.builder().put(settings); Settings.Builder builder = Settings.builder().put(settings);
builder.put("discovery.zen.ping.multicast.group", "224.2.3." + randomIntBetween(0, 255)); builder.put("discovery.zen.ping.multicast.group", "224.2.3." + randomIntBetween(0, 255));
@ -57,6 +59,7 @@ public class MulticastZenPingTests extends ESTestCase {
} }
public void testSimplePings() throws InterruptedException { public void testSimplePings() throws InterruptedException {
assumeTrue("https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=193246", Constants.FREE_BSD == false);
Settings settings = Settings.EMPTY; Settings settings = Settings.EMPTY;
settings = buildRandomMulticast(settings); settings = buildRandomMulticast(settings);
Thread.sleep(30000); Thread.sleep(30000);
@ -129,8 +132,16 @@ public class MulticastZenPingTests extends ESTestCase {
} }
} }
// This test is here because when running on FreeBSD, if no tests are
// executed for the 'multicast' project it will assume everything
// failed, so we need to have at least one test that runs.
public void testAlwaysRun() throws Exception {
assertTrue(true);
}
@SuppressForbidden(reason = "I bind to wildcard addresses. I am a total nightmare") @SuppressForbidden(reason = "I bind to wildcard addresses. I am a total nightmare")
public void testExternalPing() throws Exception { public void testExternalPing() throws Exception {
assumeTrue("https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=193246", Constants.FREE_BSD == false);
Settings settings = Settings.EMPTY; Settings settings = Settings.EMPTY;
settings = buildRandomMulticast(settings); settings = buildRandomMulticast(settings);

View File

@ -7,7 +7,7 @@
- match: - match:
$body: | $body: |
/ #host ip heap.percent ram.percent cpu load node.role master name / #host ip heap.percent ram.percent cpu load node.role master name
^ (\S+ \s+ (\d{1,3}\.){3}\d{1,3} \s+ \d+ \s+ \d* \s+ \d* \s+ (-)?\d*(\.\d+)? \s+ [-dc] \s+ [-*mx] \s+ (\S+\s?)+ \n)+ $/ ^ (\S+ \s+ (\d{1,3}\.){3}\d{1,3} \s+ \d+ \s+ \d* \s+ (-)?\d* \s+ (-)?\d*(\.\d+)? \s+ [-dc] \s+ [-*mx] \s+ (\S+\s?)+ \n)+ $/
- do: - do:
cat.nodes: cat.nodes:
@ -16,7 +16,7 @@
- match: - match:
$body: | $body: |
/^ host \s+ ip \s+ heap\.percent \s+ ram\.percent \s+ cpu \s+ load \s+ node\.role \s+ master \s+ name \n /^ host \s+ ip \s+ heap\.percent \s+ ram\.percent \s+ cpu \s+ load \s+ node\.role \s+ master \s+ name \n
(\S+ \s+ (\d{1,3}\.){3}\d{1,3} \s+ \d+ \s+ \d* \s+ \d* \s+ (-)?\d*(\.\d+)? \s+ [-dc] \s+ [-*mx] \s+ (\S+\s?)+ \n)+ $/ (\S+ \s+ (\d{1,3}\.){3}\d{1,3} \s+ \d+ \s+ \d* \s+ (-)?\d* \s+ (-)?\d*(\.\d+)? \s+ [-dc] \s+ [-*mx] \s+ (\S+\s?)+ \n)+ $/
- do: - do:
cat.nodes: cat.nodes: