Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TEST] rename AsyncSearchActionTests to IT and move it out of unit tests #54520

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions x-pack/plugin/async-search/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ archivesBaseName = 'x-pack-async-search'
compileJava.options.compilerArgs << "-Xlint:-rawtypes"
compileTestJava.options.compilerArgs << "-Xlint:-rawtypes"

integTest.enabled = false

// add all sub-projects of the qa sub-project
gradle.projectsEvaluated {
project.subprojects
Expand All @@ -40,3 +38,16 @@ dependencies {
dependencyLicenses {
ignoreSha 'x-pack-core'
}

integTest.enabled = false

// Instead we create a separate task to run the
// tests based on ESIntegTestCase
task internalClusterTest(type: Test) {
description = 'Java fantasy integration tests'
mustRunAfter test

include '**/*IT.class'
}

check.dependsOn internalClusterTest
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import static org.hamcrest.Matchers.lessThanOrEqualTo;

// TODO: add tests for keepAlive and expiration
public class AsyncSearchActionTests extends AsyncSearchIntegTestCase {
public class AsyncSearchActionIT extends AsyncSearchIntegTestCase {
private String indexName;
private int numShards;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ public void testRequestParameterDefaults() throws IOException {
verify(nodeClient).executeLocally(any(ActionType.class), argumentCaptor.capture(), any(ActionListener.class));
SubmitAsyncSearchRequest submitRequest = argumentCaptor.getValue();
assertEquals(TimeValue.timeValueSeconds(1), submitRequest.getWaitForCompletionTimeout());
assertEquals(false, submitRequest.isKeepOnCompletion());
assertFalse(submitRequest.isKeepOnCompletion());
assertEquals(TimeValue.timeValueDays(5), submitRequest.getKeepAlive());
// check parameters we implicitly set in the SubmitAsyncSearchRequest ctor
assertEquals(false, submitRequest.getSearchRequest().isCcsMinimizeRoundtrips());
assertFalse(submitRequest.getSearchRequest().isCcsMinimizeRoundtrips());
assertEquals(5, submitRequest.getSearchRequest().getBatchedReduceSize());
assertEquals(true, submitRequest.getSearchRequest().requestCache());
assertEquals(1, submitRequest.getSearchRequest().getPreFilterShardSize().intValue());
Expand All @@ -72,8 +72,8 @@ public void testParameters() throws IOException {
boolean requestCache = randomBoolean();
doTestParameter("request_cache", Boolean.toString(requestCache), requestCache,
r -> r.getSearchRequest().requestCache());
Integer batchReduceSize = randomIntBetween(2, 50);
doTestParameter("batched_reduce_size", Integer.toString(batchReduceSize), batchReduceSize,
int batchedReduceSize = randomIntBetween(2, 50);
doTestParameter("batched_reduce_size", Integer.toString(batchedReduceSize), batchedReduceSize,
r -> r.getSearchRequest().getBatchedReduceSize());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be cleaner to also clean up the channels being tracked due to the dispatchRequest calls from this test. I gave it a try though and it was not trivial, and the same should be done in RestCancellableNodeClientTests where we actually assume that we may have channels in the map already, hence we only check the delta since the test has started. I wonder if it's worth looking into cleaning the channels up after both tests have executed, or not.

}

Expand Down