Skip to content

Commit 0451f37

Browse files
Add YAML test capabilities
1 parent 78f074c commit 0451f37

File tree

2 files changed

+66
-60
lines changed

2 files changed

+66
-60
lines changed

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.allocation_explain/10_basic.yml

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -560,12 +560,12 @@
560560
---
561561
"cluster shard allocation explanation test with empty body and no URL parameters":
562562
- requires:
563-
test_runner_features: capabilities
564563
capabilities:
565564
- method: GET
566565
path: /_cluster/allocation/explain
567-
parameters: [ index, shard, primary, current_node ]
568-
reason: "Path parameter support was added in version 9.2.0"
566+
capabilities: [ query_parameter_support ]
567+
test_runner_features: [ capabilities ]
568+
reason: "Query parameter support was added in version 9.2.0"
569569

570570
- do:
571571
indices.create:
@@ -585,12 +585,12 @@
585585
---
586586
"cluster shard allocation explanation test with only index provided in URL":
587587
- requires:
588-
test_runner_features: capabilities
589588
capabilities:
590589
- method: GET
591590
path: /_cluster/allocation/explain
592-
parameters: [ index, shard, primary, current_node ]
593-
reason: "Path parameter support was added in version 9.2.0"
591+
capabilities: [ query_parameter_support ]
592+
test_runner_features: [ capabilities ]
593+
reason: "Query parameter support was added in version 9.2.0"
594594

595595
- do:
596596
indices.create:
@@ -606,12 +606,12 @@
606606
---
607607
"cluster shard allocation explanation test with only shard provided in URL":
608608
- requires:
609-
test_runner_features: capabilities
610609
capabilities:
611610
- method: GET
612611
path: /_cluster/allocation/explain
613-
parameters: [ index, shard, primary, current_node ]
614-
reason: "Path parameter support was added in version 9.2.0"
612+
capabilities: [ query_parameter_support ]
613+
test_runner_features: [ capabilities ]
614+
reason: "Query parameter support was added in version 9.2.0"
615615

616616
- do:
617617
indices.create:
@@ -627,12 +627,12 @@
627627
---
628628
"cluster shard allocation explanation test with only primary provided in URL":
629629
- requires:
630-
test_runner_features: capabilities
631630
capabilities:
632631
- method: GET
633632
path: /_cluster/allocation/explain
634-
parameters: [ index, shard, primary, current_node ]
635-
reason: "Path parameter support was added in version 9.2.0"
633+
capabilities: [ query_parameter_support ]
634+
test_runner_features: [ capabilities ]
635+
reason: "Query parameter support was added in version 9.2.0"
636636

637637
- do:
638638
indices.create:
@@ -648,12 +648,12 @@
648648
---
649649
"cluster shard allocation explanation test with only index and shard provided in URL":
650650
- requires:
651-
test_runner_features: capabilities
652651
capabilities:
653652
- method: GET
654653
path: /_cluster/allocation/explain
655-
parameters: [ index, shard, primary, current_node ]
656-
reason: "Path parameter support was added in version 9.2.0"
654+
capabilities: [ query_parameter_support ]
655+
test_runner_features: [ capabilities ]
656+
reason: "Query parameter support was added in version 9.2.0"
657657

658658
- do:
659659
indices.create:
@@ -670,12 +670,12 @@
670670
---
671671
"cluster shard allocation explanation test with only shard and primary provided in the URL":
672672
- requires:
673-
test_runner_features: capabilities
674673
capabilities:
675674
- method: GET
676675
path: /_cluster/allocation/explain
677-
parameters: [ index, shard, primary, current_node ]
678-
reason: "Path parameter support was added in version 9.2.0"
676+
capabilities: [ query_parameter_support ]
677+
test_runner_features: [ capabilities ]
678+
reason: "Query parameter support was added in version 9.2.0"
679679

680680
- do:
681681
indices.create:
@@ -692,12 +692,12 @@
692692
---
693693
"cluster shard allocation explanation test with only index and primary provided in the URL":
694694
- requires:
695-
test_runner_features: capabilities
696695
capabilities:
697696
- method: GET
698697
path: /_cluster/allocation/explain
699-
parameters: [ index, shard, primary, current_node ]
700-
reason: "Path parameter support was added in version 9.2.0"
698+
capabilities: [ query_parameter_support ]
699+
test_runner_features: [ capabilities ]
700+
reason: "Query parameter support was added in version 9.2.0"
701701

702702
- do:
703703
indices.create:
@@ -714,12 +714,12 @@
714714
---
715715
"cluster shard allocation explanation test with 3 parameters in the URL":
716716
- requires:
717-
test_runner_features: capabilities
718717
capabilities:
719718
- method: GET
720719
path: /_cluster/allocation/explain
721-
parameters: [ index, shard, primary, current_node ]
722-
reason: "Path parameter support was added in version 9.2.0"
720+
capabilities: [ query_parameter_support ]
721+
test_runner_features: [ capabilities ]
722+
reason: "Query parameter support was added in version 9.2.0"
723723

724724
- do:
725725
indices.create:
@@ -746,12 +746,12 @@
746746
---
747747
"cluster shard allocation explanation test with all parameters in the URL":
748748
- requires:
749-
test_runner_features: capabilities
750749
capabilities:
751750
- method: GET
752751
path: /_cluster/allocation/explain
753-
parameters: [ index, shard, primary, current_node ]
754-
reason: "Path parameter support was added in version 9.2.0"
752+
capabilities: [ query_parameter_support ]
753+
test_runner_features: [ capabilities ]
754+
reason: "Query parameter support was added in version 9.2.0"
755755

756756
- do:
757757
indices.create:
@@ -784,12 +784,12 @@
784784
---
785785
"cluster shard allocation explanation test with parameters passed in both the body and URL":
786786
- requires:
787-
test_runner_features: capabilities
788787
capabilities:
789788
- method: GET
790789
path: /_cluster/allocation/explain
791-
parameters: [ index, shard, primary, current_node ]
792-
reason: "Path parameter support was added in version 9.2.0"
790+
capabilities: [ query_parameter_support ]
791+
test_runner_features: [ capabilities ]
792+
reason: "Query parameter support was added in version 9.2.0"
793793

794794
- do:
795795
indices.create:
@@ -806,12 +806,12 @@
806806
---
807807
"cluster shard allocation explanation test with numerical index parameter passed in URL":
808808
- requires:
809-
test_runner_features: capabilities
810809
capabilities:
811810
- method: GET
812811
path: /_cluster/allocation/explain
813-
parameters: [ index, shard, primary, current_node ]
814-
reason: "Path parameter support was added in version 9.2.0"
812+
capabilities: [ query_parameter_support ]
813+
test_runner_features: [ capabilities ]
814+
reason: "Query parameter support was added in version 9.2.0"
815815

816816
- do:
817817
indices.create:
@@ -832,12 +832,12 @@
832832
---
833833
"cluster shard allocation explanation test with incorrect index parameter passed in URL":
834834
- requires:
835-
test_runner_features: capabilities
836835
capabilities:
837836
- method: GET
838837
path: /_cluster/allocation/explain
839-
parameters: [ index, shard, primary, current_node ]
840-
reason: "Path parameter support was added in version 9.2.0"
838+
capabilities: [ query_parameter_support ]
839+
test_runner_features: [ capabilities ]
840+
reason: "Query parameter support was added in version 9.2.0"
841841

842842
- do:
843843
indices.create:
@@ -858,12 +858,12 @@
858858
---
859859
"cluster shard allocation explanation test with an invalid, string shard parameter passed in URL":
860860
- requires:
861-
test_runner_features: capabilities
862861
capabilities:
863862
- method: GET
864863
path: /_cluster/allocation/explain
865-
parameters: [ index, shard, primary, current_node ]
866-
reason: "Path parameter support was added in version 9.2.0"
864+
capabilities: [ query_parameter_support ]
865+
test_runner_features: [ capabilities ]
866+
reason: "Query parameter support was added in version 9.2.0"
867867

868868
- do:
869869
indices.create:
@@ -881,12 +881,12 @@
881881
---
882882
"cluster shard allocation explanation test with a valid, string shard parameter passed in URL":
883883
- requires:
884-
test_runner_features: capabilities
885884
capabilities:
886885
- method: GET
887886
path: /_cluster/allocation/explain
888-
parameters: [ index, shard, primary, current_node ]
889-
reason: "Path parameter support was added in version 9.2.0"
887+
capabilities: [ query_parameter_support ]
888+
test_runner_features: [ capabilities ]
889+
reason: "Query parameter support was added in version 9.2.0"
890890

891891
- do:
892892
indices.create:
@@ -913,12 +913,12 @@
913913
---
914914
"cluster shard allocation explanation test with float shard parameter passed in URL":
915915
- requires:
916-
test_runner_features: capabilities
917916
capabilities:
918917
- method: GET
919918
path: /_cluster/allocation/explain
920-
parameters: [ index, shard, primary, current_node ]
921-
reason: "Path parameter support was added in version 9.2.0"
919+
capabilities: [ query_parameter_support ]
920+
test_runner_features: [ capabilities ]
921+
reason: "Query parameter support was added in version 9.2.0"
922922

923923
- do:
924924
indices.create:
@@ -936,12 +936,12 @@
936936
---
937937
"cluster shard allocation explanation test with numerical primary parameter passed in URL":
938938
- requires:
939-
test_runner_features: capabilities
940939
capabilities:
941940
- method: GET
942941
path: /_cluster/allocation/explain
943-
parameters: [ index, shard, primary, current_node ]
944-
reason: "Path parameter support was added in version 9.2.0"
942+
capabilities: [ query_parameter_support ]
943+
test_runner_features: [ capabilities ]
944+
reason: "Query parameter support was added in version 9.2.0"
945945

946946
- do:
947947
indices.create:
@@ -959,12 +959,12 @@
959959
---
960960
"cluster shard allocation explanation test with invalid primary parameter passed in URL":
961961
- requires:
962-
test_runner_features: capabilities
963962
capabilities:
964963
- method: GET
965964
path: /_cluster/allocation/explain
966-
parameters: [ index, shard, primary, current_node ]
967-
reason: "Path parameter support was added in version 9.2.0"
965+
capabilities: [ query_parameter_support ]
966+
test_runner_features: [ capabilities ]
967+
reason: "Query parameter support was added in version 9.2.0"
968968

969969
- do:
970970
indices.create:
@@ -982,12 +982,12 @@
982982
---
983983
"cluster shard allocation explanation test with a valid, string primary parameter passed in URL":
984984
- requires:
985-
test_runner_features: capabilities
986985
capabilities:
987986
- method: GET
988987
path: /_cluster/allocation/explain
989-
parameters: [ index, shard, primary, current_node ]
990-
reason: "Path parameter support was added in version 9.2.0"
988+
capabilities: [ query_parameter_support ]
989+
test_runner_features: [ capabilities ]
990+
reason: "Query parameter support was added in version 9.2.0"
991991

992992
- do:
993993
indices.create:
@@ -1014,12 +1014,12 @@
10141014
---
10151015
"cluster shard allocation explanation test with an invalid, string primary parameter passed in URL":
10161016
- requires:
1017-
test_runner_features: capabilities
10181017
capabilities:
10191018
- method: GET
10201019
path: /_cluster/allocation/explain
1021-
parameters: [ index, shard, primary, current_node ]
1022-
reason: "Path parameter support was added in version 9.2.0"
1020+
capabilities: [ query_parameter_support ]
1021+
test_runner_features: [ capabilities ]
1022+
reason: "Query parameter support was added in version 9.2.0"
10231023

10241024
- do:
10251025
indices.create:
@@ -1037,12 +1037,12 @@
10371037
---
10381038
"cluster shard allocation explanation test with numerical current node parameter passed in URL":
10391039
- requires:
1040-
test_runner_features: capabilities
10411040
capabilities:
10421041
- method: GET
10431042
path: /_cluster/allocation/explain
1044-
parameters: [ index, shard, primary, current_node ]
1045-
reason: "Path parameter support was added in version 9.2.0"
1043+
capabilities: [ query_parameter_support ]
1044+
test_runner_features: [ capabilities ]
1045+
reason: "Query parameter support was added in version 9.2.0"
10461046

10471047
- do:
10481048
indices.create:

server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import java.io.IOException;
2424
import java.util.List;
25+
import java.util.Set;
2526

2627
import static org.elasticsearch.rest.RestRequest.Method.GET;
2728
import static org.elasticsearch.rest.RestRequest.Method.POST;
@@ -98,6 +99,11 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC
9899
);
99100
}
100101

102+
@Override
103+
public Set<String> supportedCapabilities() {
104+
return Set.of("query_parameter_support");
105+
}
106+
101107
@Override
102108
public boolean canTripCircuitBreaker() {
103109
return false;

0 commit comments

Comments
 (0)