[TEST] only use internal API if we are running against an internal cluster

This commit is contained in:
Simon Willnauer 2015-10-11 20:54:42 +02:00
parent e95af69fb7
commit 1205c66cfb
1 changed files with 5 additions and 5 deletions

View File

@ -1479,18 +1479,18 @@ public abstract class ESIntegTestCase extends ESTestCase {
if (rarely()) { if (rarely()) {
if (rarely()) { if (rarely()) {
client().admin().indices().prepareRefresh(indices).setIndicesOptions(IndicesOptions.lenientExpandOpen()).execute( client().admin().indices().prepareRefresh(indices).setIndicesOptions(IndicesOptions.lenientExpandOpen()).execute(
new LatchedActionListener<RefreshResponse>(newLatch(inFlightAsyncOperations))); new LatchedActionListener<>(newLatch(inFlightAsyncOperations)));
} else if (maybeFlush && rarely()) { } else if (maybeFlush && rarely()) {
if (randomBoolean()) { if (randomBoolean()) {
client().admin().indices().prepareFlush(indices).setIndicesOptions(IndicesOptions.lenientExpandOpen()).execute( client().admin().indices().prepareFlush(indices).setIndicesOptions(IndicesOptions.lenientExpandOpen()).execute(
new LatchedActionListener<FlushResponse>(newLatch(inFlightAsyncOperations))); new LatchedActionListener<>(newLatch(inFlightAsyncOperations)));
} else { } else if (isInternalCluster()) {
internalCluster().getInstance(SyncedFlushService.class).attemptSyncedFlush(indices, IndicesOptions.lenientExpandOpen(), internalCluster().getInstance(SyncedFlushService.class).attemptSyncedFlush(indices, IndicesOptions.lenientExpandOpen(),
new LatchedActionListener<IndicesSyncedFlushResult>(newLatch(inFlightAsyncOperations))); new LatchedActionListener<>(newLatch(inFlightAsyncOperations)));
} }
} else if (rarely()) { } else if (rarely()) {
client().admin().indices().prepareOptimize(indices).setIndicesOptions(IndicesOptions.lenientExpandOpen()).setMaxNumSegments(between(1, 10)).setFlush(maybeFlush && randomBoolean()).execute( client().admin().indices().prepareOptimize(indices).setIndicesOptions(IndicesOptions.lenientExpandOpen()).setMaxNumSegments(between(1, 10)).setFlush(maybeFlush && randomBoolean()).execute(
new LatchedActionListener<OptimizeResponse>(newLatch(inFlightAsyncOperations))); new LatchedActionListener<>(newLatch(inFlightAsyncOperations)));
} }
} }
while (inFlightAsyncOperations.size() > MAX_IN_FLIGHT_ASYNC_INDEXES) { while (inFlightAsyncOperations.size() > MAX_IN_FLIGHT_ASYNC_INDEXES) {