HLRC: Fixing bug when getting a missing pipeline (#34286)
closes #34119
This commit is contained in:
parent
06993e0c35
commit
6f32f7138d
|
@ -29,6 +29,7 @@ import org.elasticsearch.action.ingest.SimulatePipelineResponse;
|
|||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
||||
import static java.util.Collections.emptySet;
|
||||
|
||||
|
@ -83,7 +84,7 @@ public final class IngestClient {
|
|||
*/
|
||||
public GetPipelineResponse getPipeline(GetPipelineRequest request, RequestOptions options) throws IOException {
|
||||
return restHighLevelClient.performRequestAndParseEntity( request, IngestRequestConverters::getPipeline, options,
|
||||
GetPipelineResponse::fromXContent, emptySet());
|
||||
GetPipelineResponse::fromXContent, Collections.singleton(404));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -96,7 +97,7 @@ public final class IngestClient {
|
|||
*/
|
||||
public void getPipelineAsync(GetPipelineRequest request, RequestOptions options, ActionListener<GetPipelineResponse> listener) {
|
||||
restHighLevelClient.performRequestAsyncAndParseEntity( request, IngestRequestConverters::getPipeline, options,
|
||||
GetPipelineResponse::fromXContent, listener, emptySet());
|
||||
GetPipelineResponse::fromXContent, listener, Collections.singleton(404));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -78,6 +78,16 @@ public class IngestClientIT extends ESRestHighLevelClientTestCase {
|
|||
assertEquals(expectedConfig.getConfigAsMap(), response.pipelines().get(0).getConfigAsMap());
|
||||
}
|
||||
|
||||
public void testGetNonexistentPipeline() throws IOException {
|
||||
String id = "nonexistent_pipeline_id";
|
||||
|
||||
GetPipelineRequest request = new GetPipelineRequest(id);
|
||||
|
||||
GetPipelineResponse response =
|
||||
execute(request, highLevelClient().ingest()::getPipeline, highLevelClient().ingest()::getPipelineAsync);
|
||||
assertFalse(response.isFound());
|
||||
}
|
||||
|
||||
public void testDeletePipeline() throws IOException {
|
||||
String id = "some_pipeline_id";
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue