Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose capability checks for YAML REST tests (#108425)
Co-authored-by: Simon Cooper <simon.cooper@elastic.co>
- Loading branch information
Showing
8 changed files
with
307 additions
and
24 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
rest-api-spec/src/main/resources/rest-api-spec/api/capabilities.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"capabilities": { | ||
"documentation": { | ||
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/capabilities.html", | ||
"description": "Checks if the specified combination of method, API, parameters, and arbitrary capabilities are supported" | ||
}, | ||
"stability": "experimental", | ||
"visibility": "private", | ||
"headers": { | ||
"accept": [ | ||
"application/json" | ||
] | ||
}, | ||
"url": { | ||
"paths": [ | ||
{ | ||
"path": "/_capabilities", | ||
"methods": [ | ||
"GET" | ||
] | ||
} | ||
] | ||
}, | ||
"params": { | ||
"method": { | ||
"type": "enum", | ||
"description": "REST method to check", | ||
"options": [ | ||
"GET", "HEAD", "POST", "PUT", "DELETE" | ||
], | ||
"default": "GET" | ||
}, | ||
"path": { | ||
"type": "string", | ||
"description": "API path to check" | ||
}, | ||
"parameters": { | ||
"type": "string", | ||
"description": "Comma-separated list of API parameters to check" | ||
}, | ||
"capabilities": { | ||
"type": "string", | ||
"description": "Comma-separated list of arbitrary API capabilities to check" | ||
} | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/capabilities/10_basic.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
"Capabilities API": | ||
|
||
- requires: | ||
capabilities: | ||
- method: GET | ||
path: /_capabilities | ||
parameters: [method, path, parameters, capabilities] | ||
capabilities: [] | ||
reason: "capabilities api requires itself to be supported" | ||
|
||
- do: | ||
capabilities: | ||
method: GET | ||
path: /_capabilities | ||
parameters: method,path,parameters,capabilities | ||
error_trace: false | ||
|
||
- match: { supported: true } | ||
|
||
- do: | ||
capabilities: | ||
method: GET | ||
path: /_capabilities | ||
parameters: unknown | ||
error_trace: false | ||
|
||
- match: { supported: false } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.