|
63 | 63 | import org.opensearch.rest.action.admin.cluster.RestRestoreSnapshotAction;
|
64 | 64 | import org.opensearch.rest.action.admin.cluster.RestSnapshotsStatusAction;
|
65 | 65 | import org.opensearch.rest.action.admin.cluster.RestVerifyRepositoryAction;
|
| 66 | +import org.opensearch.rest.action.admin.cluster.RestDeleteStoredScriptAction; |
| 67 | +import org.opensearch.rest.action.admin.cluster.RestGetStoredScriptAction; |
| 68 | +import org.opensearch.rest.action.admin.cluster.RestPutStoredScriptAction; |
66 | 69 | import org.opensearch.rest.action.cat.RestAllocationAction;
|
67 | 70 | import org.opensearch.rest.action.cat.RestRepositoriesAction;
|
68 | 71 | import org.opensearch.rest.action.cat.RestThreadPoolAction;
|
|
76 | 79 | import org.opensearch.rest.action.cat.RestPendingClusterTasksAction;
|
77 | 80 | import org.opensearch.rest.action.cat.RestSegmentsAction;
|
78 | 81 | import org.opensearch.rest.action.cat.RestSnapshotAction;
|
| 82 | +import org.opensearch.rest.action.ingest.RestDeletePipelineAction; |
| 83 | +import org.opensearch.rest.action.ingest.RestGetPipelineAction; |
| 84 | +import org.opensearch.rest.action.ingest.RestPutPipelineAction; |
79 | 85 | import org.opensearch.test.OpenSearchTestCase;
|
80 | 86 | import org.opensearch.test.rest.FakeRestRequest;
|
81 | 87 | import org.opensearch.threadpool.TestThreadPool;
|
@@ -612,6 +618,59 @@ public void testVerifyRepository() {
|
612 | 618 | assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE);
|
613 | 619 | }
|
614 | 620 |
|
| 621 | + public void testDeletePipeline() { |
| 622 | + FakeRestRequest request = new FakeRestRequest(); |
| 623 | + request.params().put("cluster_manager_timeout", "1h"); |
| 624 | + request.params().put("master_timeout", "3s"); |
| 625 | + request.params().put("id", "test"); |
| 626 | + RestDeletePipelineAction action = new RestDeletePipelineAction(); |
| 627 | + Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(request, client)); |
| 628 | + assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); |
| 629 | + assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); |
| 630 | + } |
| 631 | + |
| 632 | + public void testGetPipeline() { |
| 633 | + RestGetPipelineAction action = new RestGetPipelineAction(); |
| 634 | + Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); |
| 635 | + assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); |
| 636 | + assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); |
| 637 | + } |
| 638 | + |
| 639 | + public void testPutPipeline() { |
| 640 | + FakeRestRequest request = getFakeRestRequestWithBody(); |
| 641 | + request.params().put("cluster_manager_timeout", "2m"); |
| 642 | + request.params().put("master_timeout", "3s"); |
| 643 | + request.params().put("id", "test"); |
| 644 | + RestPutPipelineAction action = new RestPutPipelineAction(); |
| 645 | + Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(request, client)); |
| 646 | + assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); |
| 647 | + assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); |
| 648 | + } |
| 649 | + |
| 650 | + public void testDeleteStoredScript() { |
| 651 | + RestDeleteStoredScriptAction action = new RestDeleteStoredScriptAction(); |
| 652 | + Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); |
| 653 | + assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); |
| 654 | + assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); |
| 655 | + } |
| 656 | + |
| 657 | + public void testGetStoredScript() { |
| 658 | + RestGetStoredScriptAction action = new RestGetStoredScriptAction(); |
| 659 | + Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); |
| 660 | + assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); |
| 661 | + assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); |
| 662 | + } |
| 663 | + |
| 664 | + public void testPutStoredScript() { |
| 665 | + RestPutStoredScriptAction action = new RestPutStoredScriptAction(); |
| 666 | + Exception e = assertThrows( |
| 667 | + OpenSearchParseException.class, |
| 668 | + () -> action.prepareRequest(getRestRequestWithBodyWithBothParams(), client) |
| 669 | + ); |
| 670 | + assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); |
| 671 | + assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE, "empty templates should no longer be used"); |
| 672 | + } |
| 673 | + |
615 | 674 | private MasterNodeRequest getMasterNodeRequest() {
|
616 | 675 | return new MasterNodeRequest() {
|
617 | 676 | @Override
|
|
0 commit comments