Skip to content

Commit

Permalink
more test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
smalyshev committed Dec 13, 2024
1 parent 85220a7 commit 1a93f9f
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1615,7 +1615,7 @@ protected static void doConfigureClient(RestClientBuilder builder, Settings sett
defaultHeaders[i++] = new BasicHeader(entry.getKey(), entry.getValue());
}
builder.setDefaultHeaders(defaultHeaders);
final String socketTimeoutString = Objects.requireNonNullElse(settings.get(CLIENT_SOCKET_TIMEOUT), "60s");
final String socketTimeoutString = Objects.requireNonNullElse(settings.get(CLIENT_SOCKET_TIMEOUT), "800s");
final TimeValue socketTimeout = TimeValue.parseTimeValue(socketTimeoutString, CLIENT_SOCKET_TIMEOUT);
builder.setRequestConfigCallback(conf -> conf.setSocketTimeout(Math.toIntExact(socketTimeout.getMillis())));
if (settings.hasValue(CLIENT_PATH_PREFIX)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
import java.io.IOException;
import java.util.Objects;

/**
* Request for TransportEsqlAsyncStopAction action.
*/
public class AsyncStopRequest extends ActionRequest {
private final String id;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,11 @@ public void testUngroupedAggs() throws Exception {
private void assertClusterDetailsMap(Map<String, Object> result, boolean remoteOnly) {
@SuppressWarnings("unchecked")
Map<String, Object> clusters = (Map<String, Object>) result.get("_clusters");
assertThat(clusters.size(), equalTo(7));
assertThat(clusters.keySet(), equalTo(Set.of("total", "successful", "running", "skipped", "partial", "failed", "details")));
assertThat(clusters.size(), equalTo(8));
assertThat(
clusters.keySet(),
equalTo(Set.of("total", "successful", "running", "skipped", "partial", "failed", "details", "is_partial"))
);
int expectedNumClusters = remoteOnly ? 1 : 2;
Set<String> expectedClusterAliases = remoteOnly ? Set.of("remote_cluster") : Set.of("remote_cluster", "(local)");

Expand All @@ -268,6 +271,7 @@ private void assertClusterDetailsMap(Map<String, Object> result, boolean remoteO
assertThat(clusters.get("skipped"), equalTo(0));
assertThat(clusters.get("partial"), equalTo(0));
assertThat(clusters.get("failed"), equalTo(0));
assertThat(clusters.get("is_partial"), equalTo(false));

@SuppressWarnings("unchecked")
Map<String, Object> details = (Map<String, Object>) clusters.get("details");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ public void testSuccessfulPathways() throws Exception {
EsqlExecutionInfo executionInfo = asyncResponse.getExecutionInfo();
assertNotNull(executionInfo);
assertThat(executionInfo.overallTook().millis(), greaterThanOrEqualTo(1L));
assertThat(executionInfo.isPartial(), equalTo(false));

EsqlExecutionInfo.Cluster clusterA = executionInfo.getCluster(REMOTE_CLUSTER_1);
assertThat(clusterA.getStatus(), equalTo(EsqlExecutionInfo.Cluster.Status.SUCCESSFUL));
Expand Down Expand Up @@ -316,6 +317,7 @@ public void testAsyncQueriesWithLimit0() throws IOException {
assertThat(overallTookMillis, greaterThanOrEqualTo(0L));
assertThat(executionInfo.includeCCSMetadata(), equalTo(responseExpectMeta));
assertThat(executionInfo.clusterAliases(), equalTo(Set.of(LOCAL_CLUSTER, REMOTE_CLUSTER_1, REMOTE_CLUSTER_2)));
assertThat(executionInfo.isPartial(), equalTo(false));

EsqlExecutionInfo.Cluster remoteCluster = executionInfo.getCluster(REMOTE_CLUSTER_1);
assertThat(remoteCluster.getIndexExpression(), equalTo("logs*"));
Expand All @@ -327,7 +329,7 @@ public void testAsyncQueriesWithLimit0() throws IOException {
assertThat(remoteCluster.getSkippedShards(), equalTo(0));
assertThat(remoteCluster.getFailedShards(), equalTo(0));

EsqlExecutionInfo.Cluster remote2Cluster = executionInfo.getCluster(REMOTE_CLUSTER_1);
EsqlExecutionInfo.Cluster remote2Cluster = executionInfo.getCluster(REMOTE_CLUSTER_2);
assertThat(remote2Cluster.getIndexExpression(), equalTo("logs*"));
assertThat(remote2Cluster.getStatus(), equalTo(EsqlExecutionInfo.Cluster.Status.SUCCESSFUL));
assertThat(remote2Cluster.getTook().millis(), greaterThanOrEqualTo(0L));
Expand Down Expand Up @@ -359,9 +361,6 @@ public void testAsyncQueriesWithLimit0() throws IOException {

public void testStopQuery() throws Exception {
Map<String, Object> testClusterInfo = setupClusters(3);
int localNumShards = (Integer) testClusterInfo.get("local.num_shards");
int remote1NumShards = (Integer) testClusterInfo.get("remote1.num_shards");
int remote2NumShards = (Integer) testClusterInfo.get("remote2.blocking_index.num_shards");

Tuple<Boolean, Boolean> includeCCSMetadata = randomIncludeCCSMetadata();
Boolean requestIncludeMeta = includeCCSMetadata.v1();
Expand Down Expand Up @@ -408,6 +407,34 @@ public void testStopQuery() throws Exception {
assertThat(asyncResponse.isRunning(), is(false));
assertThat(asyncResponse.columns().size(), equalTo(1));
assertThat(asyncResponse.values().hasNext(), is(true));

EsqlExecutionInfo executionInfo = asyncResponse.getExecutionInfo();
assertNotNull(executionInfo);
assertThat(executionInfo.isCrossClusterSearch(), is(true));
long overallTookMillis = executionInfo.overallTook().millis();
assertThat(overallTookMillis, greaterThanOrEqualTo(0L));
assertThat(executionInfo.clusterAliases(), equalTo(Set.of(LOCAL_CLUSTER, REMOTE_CLUSTER_1, REMOTE_CLUSTER_2)));
assertThat(executionInfo.isPartial(), equalTo(true));

EsqlExecutionInfo.Cluster remoteCluster = executionInfo.getCluster(REMOTE_CLUSTER_1);
assertThat(remoteCluster.getIndexExpression(), equalTo("logs-*"));
assertThat(remoteCluster.getStatus(), equalTo(EsqlExecutionInfo.Cluster.Status.SUCCESSFUL));
assertThat(remoteCluster.getTook().millis(), greaterThanOrEqualTo(0L));
assertThat(remoteCluster.getTook().millis(), lessThanOrEqualTo(overallTookMillis));

EsqlExecutionInfo.Cluster remote2Cluster = executionInfo.getCluster(REMOTE_CLUSTER_2);
assertThat(remote2Cluster.getIndexExpression(), equalTo("blocking"));
assertThat(remote2Cluster.getStatus(), equalTo(EsqlExecutionInfo.Cluster.Status.SUCCESSFUL));
assertThat(remote2Cluster.getTook().millis(), greaterThanOrEqualTo(0L));
assertThat(remote2Cluster.getTook().millis(), lessThanOrEqualTo(overallTookMillis));

EsqlExecutionInfo.Cluster localCluster = executionInfo.getCluster(LOCAL_CLUSTER);
assertThat(localCluster.getIndexExpression(), equalTo("logs-*"));
assertThat(localCluster.getStatus(), equalTo(EsqlExecutionInfo.Cluster.Status.SUCCESSFUL));
assertThat(localCluster.getTook().millis(), greaterThanOrEqualTo(0L));
assertThat(localCluster.getTook().millis(), lessThanOrEqualTo(overallTookMillis));

assertClusterMetadataInResponse(asyncResponse, responseExpectMeta, 3);
} finally {
AcknowledgedResponse acknowledgedResponse = deleteAsyncId(asyncExecutionId.get());
assertThat(acknowledgedResponse.isAcknowledged(), is(true));
Expand Down

0 comments on commit 1a93f9f

Please sign in to comment.