createIndex("test");
final int iters = scaledRandomIntBetween(2, 20);
final AtomicBoolean hasErrors = new AtomicBoolean(false);
for (int i = 0; i < iters; i++) {
final String type;
NodesHotThreadsRequestBuilder nodesHotThreadsRequestBuilder = client().admin().cluster().prepareNodesHotThreads();
if (randomBoolean()) {
TimeValue timeValue = new TimeValue(rarely() ? randomIntBetween(500, 5000) : randomIntBetween(20, 500));
nodesHotThreadsRequestBuilder.setInterval(timeValue);
}
if (randomBoolean()) {
nodesHotThreadsRequestBuilder.setThreads(rarely() ? randomIntBetween(500, 5000) : randomIntBetween(1, 500));
}
if (randomBoolean()) {
switch (randomIntBetween(0, 2)) {
case 2:
type = "cpu";
break;
case 1:
type = "wait";
break;
default:
type = "block";
break;
}
assertThat(type, notNullValue());
nodesHotThreadsRequestBuilder.setType(type);
} else {
type = null;
}
final CountDownLatch latch = new CountDownLatch(1);
nodesHotThreadsRequestBuilder.execute(new ActionListener<NodesHotThreadsResponse>() {
@Override
public void onResponse(NodesHotThreadsResponse nodeHotThreads) {
boolean success = false;
try {
assertThat(nodeHotThreads, notNullValue());