From 97ab82950a46e493aea935198826077e9f873315 Mon Sep 17 00:00:00 2001 From: Niyazbek Torekeldi <78027392+Tokesh@users.noreply.github.com> Date: Sun, 5 Jan 2025 18:08:14 +0500 Subject: [PATCH] Added spec with `x-ignorable:true` to check Evaluation operations (#762) * added test for x-ignorable:true Signed-off-by: Tokesh * test: added test for x-ignorable:true Signed-off-by: Tokesh * chore: fix linter Signed-off-by: Tokesh --------- Signed-off-by: Tokesh --- tools/tests/tester/MergedOpenApiSpec.test.ts | 1 + tools/tests/tester/TestResults.test.ts | 64 +++++++++++++------ .../specs/complete/namespaces/nodes.yaml | 18 ++++++ 3 files changed, 62 insertions(+), 21 deletions(-) diff --git a/tools/tests/tester/MergedOpenApiSpec.test.ts b/tools/tests/tester/MergedOpenApiSpec.test.ts index 54d65b60e..78b3616e5 100644 --- a/tools/tests/tester/MergedOpenApiSpec.test.ts +++ b/tools/tests/tester/MergedOpenApiSpec.test.ts @@ -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'], diff --git a/tools/tests/tester/TestResults.test.ts b/tools/tests/tester/TestResults.test.ts index f1c7816fe..77db46ba5 100644 --- a/tools/tests/tester/TestResults.test.ts +++ b/tools/tests/tester/TestResults.test.ts @@ -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 }) @@ -87,7 +108,8 @@ describe('TestResults', () => { { method: 'GET', path: '/nodes' } ], stories: [ - 'full_path' + 'full_path', + '/_cluster/nodes/hot_threads' ] }) fs.unlinkSync(filename) diff --git a/tools/tests/tester/fixtures/specs/complete/namespaces/nodes.yaml b/tools/tests/tester/fixtures/specs/complete/namespaces/nodes.yaml index 2b39054ea..75d7fab5c 100644 --- a/tools/tests/tester/fixtures/specs/complete/namespaces/nodes.yaml +++ b/tools/tests/tester/fixtures/specs/complete/namespaces/nodes.yaml @@ -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: @@ -88,3 +103,6 @@ components: application/json: schema: type: object + nodes.hot_threads@200: + content: + text/plain: {}