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

[Transform] Call listener in order to prevent the request from hanging #96221

Merged
merged 4 commits into from
May 18, 2023
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
5 changes: 5 additions & 0 deletions docs/changelog/96221.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 96221
summary: Call listener in order to prevent the request from hanging
area: Transform
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.concurrent.TimeUnit;

import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;

public class TransformUpdateIT extends TransformRestTestCase {

Expand Down Expand Up @@ -148,6 +149,24 @@ public void testUpdateTransferRightsSecondaryAuthHeaders() throws Exception {
updateTransferRightsTester(true);
}

public void testUpdateThatChangesSettingsButNotHeaders() throws Exception {
String transformId = "test_update_that_changes_settings";
String destIndex = transformId + "-dest";

// Create the transform
createPivotReviewsTransform(transformId, destIndex, null, null, null);

Request updateTransformRequest = createRequestWithAuth("POST", getTransformEndpoint() + transformId + "/_update", null);
updateTransformRequest.setJsonEntity("""
{ "settings": { "max_page_search_size": 123 } }""");

// Update the transform's settings
Map<String, Object> updatedConfig = entityAsMap(client().performRequest(updateTransformRequest));

// Verify that the settings got updated
assertThat(updatedConfig.get("settings"), is(equalTo(Map.of("max_page_search_size", 123))));
}

private void updateTransferRightsTester(boolean useSecondaryAuthHeaders) throws Exception {
String transformId = "transform1";
// Note: Due to a bug the transform does not fail to start after deleting the user and role, therefore invalidating
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ protected void doExecute(Task task, Request request, ActionListener<Response> li
authState,
ActionListener.wrap(aVoid -> listener.onResponse(new Response(updatedConfig)), listener::onFailure)
);
} else {
listener.onResponse(new Response(updatedConfig));
}
} else {
listener.onResponse(new Response(updatedConfig));
Expand Down