Skip to content

Commit

Permalink
Added spec with x-ignorable:true to check Evaluation operations (#762)
Browse files Browse the repository at this point in the history
* added test for x-ignorable:true

Signed-off-by: Tokesh <[email protected]>

* test: added test for x-ignorable:true

Signed-off-by: Tokesh <[email protected]>

* chore: fix linter

Signed-off-by: Tokesh <[email protected]>

---------

Signed-off-by: Tokesh <[email protected]>
  • Loading branch information
Tokesh authored Jan 5, 2025
1 parent db45550 commit 97ab829
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 21 deletions.
1 change: 1 addition & 0 deletions tools/tests/tester/MergedOpenApiSpec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe('merged API spec', () => {

test('paths', () => {
expect(spec.paths()).toEqual({
'/_cluster/nodes/hot_threads': ['get'],
'/_nodes/{id}': ['get', 'post'],
'/_superseded/nodes/{id}': ['get'],
'/cluster_manager': ['get', 'post'],
Expand Down
64 changes: 43 additions & 21 deletions tools/tests/tester/TestResults.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,47 @@ import fs from 'fs'
describe('TestResults', () => {
const spec = new MergedOpenApiSpec('tools/tests/tester/fixtures/specs/complete')

const evaluations = [{
result: Result.PASSED,
display_path: 'PUT /{index}',
full_path: 'full_path',
description: 'description',
message: 'message',
chapters: [{
title: 'title',
operation: {
method: 'PUT',
path: '/{index}'
},
overall: {
result: Result.PASSED
},
path: 'PUT /{index}'
}],
epilogues: [],
prologues: []
}]
const evaluations = [
{
result: Result.PASSED,
display_path: 'PUT /{index}',
full_path: 'full_path',
description: 'description',
message: 'message',
chapters: [{
title: 'title',
operation: {
method: 'PUT',
path: '/{index}'
},
overall: {
result: Result.PASSED
},
path: 'PUT /{index}'
}],
epilogues: [],
prologues: []
},
{
result: Result.PASSED,
display_path: 'GET /_cluster/nodes/hot_threads',
full_path: '/_cluster/nodes/hot_threads',
description: 'description',
message: 'message',
chapters: [{
title: 'title',
operation: {
method: 'GET',
path: '/_cluster/nodes/hot_threads'
},
overall: {
result: Result.PASSED
},
path: 'GET /_cluster/nodes/hot_threads'
}],
epilogues: [],
prologues: []
}]

const test_results = new TestResults(spec, { evaluations })

Expand Down Expand Up @@ -87,7 +108,8 @@ describe('TestResults', () => {
{ method: 'GET', path: '/nodes' }
],
stories: [
'full_path'
'full_path',
'/_cluster/nodes/hot_threads'
]
})
fs.unlinkSync(filename)
Expand Down
18 changes: 18 additions & 0 deletions tools/tests/tester/fixtures/specs/complete/namespaces/nodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@ paths:
$ref: '#/components/responses/nodes.info@201'
'200':
$ref: '#/components/responses/nodes.info@200'
/_cluster/nodes/hot_threads:
get:
operationId: nodes.hot_threads.0
x-operation-group: nodes.hot_threads
x-ignorable: true
deprecated: true
x-deprecation-message: The hot accepts /_cluster/nodes as prefix for backwards compatibility reasons
x-version-added: '1.0'
x-version-deprecated: '1.0'
description: Returns information about hot threads on each node in the cluster.
externalDocs:
url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-hot-threads/
responses:
'200':
$ref: '#/components/responses/nodes.hot_threads@200'
components:
requestBodies:
nodes.info:
Expand Down Expand Up @@ -88,3 +103,6 @@ components:
application/json:
schema:
type: object
nodes.hot_threads@200:
content:
text/plain: {}

0 comments on commit 97ab829

Please sign in to comment.