From 3441e2b5a41af5a5893ec89ab3d1f6e3e499c4ea Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Mon, 15 Jul 2024 13:24:29 -0500 Subject: [PATCH 1/6] Fix CI / include changes in tests to CI trigger. (#421) * Include changes in tests to CI trigger. Signed-off-by: dblock * Added cluster_manager_timeout to HEAD /{index}. --- .github/workflows/test-spec.yml | 2 ++ CHANGELOG.md | 1 + spec/namespaces/indices.yaml | 8 ++++++++ 3 files changed, 11 insertions(+) diff --git a/.github/workflows/test-spec.yml b/.github/workflows/test-spec.yml index 975bf8834..3769aa126 100644 --- a/.github/workflows/test-spec.yml +++ b/.github/workflows/test-spec.yml @@ -6,6 +6,7 @@ on: - .github/workflows/test-spec.yml - package*.json - spec/** + - tests/** - tools/src/tester/** - tsconfig.json pull_request: @@ -13,6 +14,7 @@ on: - .github/workflows/test-spec.yml - package*.json - spec/** + - tests/** - tools/src/tester/** - tsconfig.json diff --git a/CHANGELOG.md b/CHANGELOG.md index d4a709673..fd6064a82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added `file` to `/_cache/clear` and `/{index}/_cache/clear` ([#396](https://github.com/opensearch-project/opensearch-api-specification/pull/396)) - Added a workflow to run tests against the next version of OpenSearch ([#409](https://github.com/opensearch-project/opensearch-api-specification/pull/409)) - Added support for skipping tests using semver range ([#410](https://github.com/opensearch-project/opensearch-api-specification/pull/410)) +- Added `cluster_manager_timeout` to `HEAD /{index}` ([#421](https://github.com/opensearch-project/opensearch-api-specification/pull/421)) ### Changed diff --git a/spec/namespaces/indices.yaml b/spec/namespaces/indices.yaml index 1ba7e4a5c..dc113533b 100644 --- a/spec/namespaces/indices.yaml +++ b/spec/namespaces/indices.yaml @@ -894,6 +894,7 @@ paths: parameters: - $ref: '#/components/parameters/indices.exists::path.index' - $ref: '#/components/parameters/indices.exists::query.allow_no_indices' + - $ref: '#/components/parameters/indices.exists::query.cluster_manager_timeout' - $ref: '#/components/parameters/indices.exists::query.expand_wildcards' - $ref: '#/components/parameters/indices.exists::query.flat_settings' - $ref: '#/components/parameters/indices.exists::query.ignore_unavailable' @@ -3220,6 +3221,13 @@ components: schema: $ref: '../schemas/_common.yaml#/components/schemas/Indices' style: simple + indices.exists::query.cluster_manager_timeout: + name: cluster_manager_timeout + in: query + description: Operation timeout for connection to cluster-manager node. + schema: + $ref: '../schemas/_common.yaml#/components/schemas/Duration' + x-version-added: '2.0' indices.exists::query.allow_no_indices: in: query name: allow_no_indices From fd069eab557d73be44bb92b7fd2829dbfc8b55ea Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Mon, 15 Jul 2024 17:54:42 -0500 Subject: [PATCH 2/6] Added missing fields in nodes stats. (#415) Signed-off-by: dblock --- CHANGELOG.md | 1 + spec/schemas/_common.yaml | 14 ++ spec/schemas/nodes._common.yaml | 267 ++++++++++++++++++++++++++++++++ tests/nodes/stats.yaml | 9 ++ 4 files changed, 291 insertions(+) create mode 100644 tests/nodes/stats.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index fd6064a82..aa524b549 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added a workflow to run tests against the next version of OpenSearch ([#409](https://github.com/opensearch-project/opensearch-api-specification/pull/409)) - Added support for skipping tests using semver range ([#410](https://github.com/opensearch-project/opensearch-api-specification/pull/410)) - Added `cluster_manager_timeout` to `HEAD /{index}` ([#421](https://github.com/opensearch-project/opensearch-api-specification/pull/421)) +- Added missing fields to `/_nodes/stats` ([#415](https://github.com/opensearch-project/opensearch-api-specification/pull/415)) ### Changed diff --git a/spec/schemas/_common.yaml b/spec/schemas/_common.yaml index 858f1d60e..9821b6c6d 100644 --- a/spec/schemas/_common.yaml +++ b/spec/schemas/_common.yaml @@ -1732,6 +1732,11 @@ components: query_total: description: The total number of shard query operations. type: number + request: + type: object + description: Statistics about coordinator search operations for the node. + additionalProperties: + $ref: '#/components/schemas/RequestStats' search_idle_reactivate_count_total: type: number scroll_current: @@ -1800,6 +1805,15 @@ components: - size_in_bytes - uncommitted_operations - uncommitted_size_in_bytes + RequestStats: + type: object + properties: + time_in_millis: + $ref: '_common.yaml#/components/schemas/DurationValueUnitMillis' + current: + type: number + total: + type: number WarmerStats: type: object properties: diff --git a/spec/schemas/nodes._common.yaml b/spec/schemas/nodes._common.yaml index 7119fc65c..ee172b93e 100644 --- a/spec/schemas/nodes._common.yaml +++ b/spec/schemas/nodes._common.yaml @@ -135,6 +135,11 @@ components: threads: description: Number of threads in the thread pool. type: number + total_wait_time_in_nanos: + description: | + The total amount of time that tasks spend waiting in the thread pool queue. + Currently, only `search`, `search_throttled`, and `index_searcher` thread pools support this metric. + type: number Scripting: type: object properties: @@ -246,6 +251,145 @@ components: $ref: '#/components/schemas/IndexingPressure' indices: $ref: 'indices.stats.yaml#/components/schemas/ShardStats' + shard_indexing_pressure: + $ref: '#/components/schemas/ShardIndexingPressureStats' + search_backpressure: + $ref: '#/components/schemas/ShardSearchBackpressureStats' + cluster_manager_throttling: + $ref: '#/components/schemas/ShardClusterManagerThrottlingStats' + weighted_routing: + $ref: '#/components/schemas/ShardWeightedRoutingStats' + task_cancellation: + $ref: '#/components/schemas/ShardTaskCancellationStats' + resource_usage_stats: + $ref: '#/components/schemas/ShardResourceUsageStats' + search_pipeline: + $ref: '#/components/schemas/ShardSearchPipelineStats' + segment_replication_backpressure: + $ref: '#/components/schemas/ShardSegmentReplicationBackpressureStats' + repositories: + $ref: '#/components/schemas/ShardRepositoriesStats' + admission_control: + $ref: '#/components/schemas/ShardAdmissionControlStats' + caches: + $ref: '#/components/schemas/ShardCachesStats' + ShardClusterManagerThrottlingStats: + type: object + properties: + stats: + $ref: '#/components/schemas/ShardClusterManagerThrottlingStatsDetail' + ShardClusterManagerThrottlingStatsDetail: + type: object + properties: + total_throttled_tasks: + type: number + throttled_tasks_per_task_type: + type: object # TODO: list of tasks + ShardWeightedRoutingStats: + type: object + properties: + stats: + $ref: '#/components/schemas/ShardWeightedRoutingStatsDetail' + ShardWeightedRoutingStatsDetail: + type: object + properties: + fail_open_count: + type: number + ShardTaskCancellationStats: + type: object + properties: + search_shard_task: + $ref: '#/components/schemas/ShardTaskCancellationStatsDetail' + ShardTaskCancellationStatsDetail: + type: object + properties: + current_count_post_cancel: + type: number + total_count_post_cancel: + type: number + ShardSearchPipelineStats: + type: object + properties: + total_request: + $ref: '#/components/schemas/ShardSearchPipelineTotalStats' + total_response: + $ref: '#/components/schemas/ShardSearchPipelineTotalStats' + pipelines: + type: object + ShardSearchPipelineTotalStats: + type: object + properties: + count: + type: number + time_in_millis: + $ref: '_common.yaml#/components/schemas/DurationValueUnitMillis' + current: + type: number + failed: + type: number + ShardResourceUsageStats: + type: object + additionalProperties: + $ref: '#/components/schemas/ShardResourceUsageStatsDetail' + ShardResourceUsageStatsDetail: + type: object + properties: + timestamp: + type: number + cpu_utilization_percent: + $ref: '_common.yaml#/components/schemas/Percentage' + memory_utilization_percent: + $ref: '_common.yaml#/components/schemas/Percentage' + io_usage_stats: + $ref: '#/components/schemas/ShardResourceUsageStatsIoUsageStats' + ShardResourceUsageStatsIoUsageStats: + type: object + properties: + max_io_utilization_percent: + $ref: '_common.yaml#/components/schemas/Percentage' + ShardSegmentReplicationBackpressureStats: + type: object + properties: + total_rejected_requests: + type: number + ShardRepositoriesStats: + type: array + ShardAdmissionControlStats: + type: object + properties: + global_io_usage: + $ref: '#/components/schemas/UsageStats' + global_cpu_usage: + $ref: '#/components/schemas/UsageStats' + UsageStats: + type: object + properties: + transport: + $ref: '#/components/schemas/TransportUsageStats' + TransportUsageStats: + type: object + properties: + rejection_count: + type: object + ShardCachesStats: + type: object + additionalProperties: + $ref: '#/components/schemas/ShardCacheStats' + ShardCacheStats: + type: object + properties: + size_in_bytes: + type: number + evictions: + type: number + hit_count: + type: number + miss_count: + type: number + item_count: + type: number + store_name: + type: string AdaptiveSelection: type: object properties: @@ -315,6 +459,10 @@ components: available_in_bytes: description: Total number of bytes available to this Java virtual machine on this file store. type: number + cache_reserved_in_bytes: + x-version-added: '2.7' + description: Total number of cache bytes reserved available to this Java virtual machine on this file store. + type: number disk_queue: type: string disk_reads: @@ -377,6 +525,10 @@ components: total_in_bytes: description: Total size of all file stores in bytes. type: number + cache_reserved_in_bytes: + x-version-added: '2.7' + description: Total size of cache bytes reserved in all file stores. + type: number IoStats: type: object properties: @@ -528,6 +680,18 @@ components: peak_max_in_bytes: description: Largest amount of memory, in bytes, historically used by the heap. type: number + last_gc_stats: + description: Most recent GC cycle stats for a particular memory pool. + $ref: '#/components/schemas/LastGcStats' + LastGcStats: + type: object + properties: + used_in_bytes: + type: number + max_in_bytes: + type: number + usage_percent: + type: number JvmThreads: type: object properties: @@ -761,6 +925,8 @@ components: properties: cluster_state_queue: $ref: '#/components/schemas/ClusterStateQueue' + cluster_state_stats: + $ref: '#/components/schemas/ClusterStateStats' published_cluster_states: $ref: '#/components/schemas/PublishedClusterStates' cluster_state_update: @@ -788,6 +954,20 @@ components: committed: description: Number of committed cluster states in queue. type: number + ClusterStateStats: + type: object + properties: + overall: + $ref: '#/components/schemas/ClusterStateOverallStats' + ClusterStateOverallStats: + type: object + properties: + update_count: + type: number + total_time_in_millis: + $ref: '_common.yaml#/components/schemas/DurationValueUnitMillis' + failed_count: + type: number PublishedClusterStates: type: object properties: @@ -879,6 +1059,93 @@ components: properties: memory: $ref: '#/components/schemas/IndexingPressureMemory' + ShardIndexingPressureStats: + type: object + properties: + stats: + type: object + enabled: + type: boolean + enforced: + type: boolean + total_rejections_breakup_shadow_mode: + $ref: '#/components/schemas/TotalRejectionsBreakupShadowMode' + ShardSearchBackpressureStats: + type: object + properties: + search_task: + $ref: '#/components/schemas/ShardSearchBackpressureTaskStats' + search_shard_task: + $ref: '#/components/schemas/ShardSearchBackpressureTaskStats' + mode: + $ref: '#/components/schemas/ShardSearchBackpressureMode' + ShardSearchBackpressureMode: + type: string + enum: + - disabled + - enforced + - monitor_only + ShardSearchBackpressureTaskStats: + type: object + properties: + resource_tracker_stats: + $ref: '#/components/schemas/ShardSearchBackpressureTaskResourceTrackerStats' + cancellation_stats: + $ref: '#/components/schemas/ShardSearchBackpressureTaskCancellationStats' + ShardSearchBackpressureTaskResourceTrackerStats: + type: object + properties: + heap_usage_tracker: + $ref: '#/components/schemas/ShardSearchBackpressureTaskResourceTrackerHeapUsageTrackerStats' + elapsed_time_tracker: + $ref: '#/components/schemas/ShardSearchBackpressureTaskResourceTrackerElapsedTimeTrackerStats' + cpu_usage_tracker: + $ref: '#/components/schemas/ShardSearchBackpressureTaskResourceTrackerCpuUsageTrackerStats' + ShardSearchBackpressureTaskResourceTrackerHeapUsageTrackerStats: + type: object + properties: + cancellation_count: + type: number + current_max_bytes: + type: number + current_avg_bytes: + type: number + rolling_avg_bytes: + type: number + ShardSearchBackpressureTaskResourceTrackerElapsedTimeTrackerStats: + type: object + properties: + cancellation_count: + type: number + current_max_millis: + $ref: '_common.yaml#/components/schemas/DurationValueUnitMillis' + current_avg_millis: + $ref: '_common.yaml#/components/schemas/DurationValueUnitMillis' + ShardSearchBackpressureTaskResourceTrackerCpuUsageTrackerStats: + type: object + properties: + cancellation_count: + type: number + current_max_millis: + $ref: '_common.yaml#/components/schemas/DurationValueUnitMillis' + current_avg_millis: + $ref: '_common.yaml#/components/schemas/DurationValueUnitMillis' + ShardSearchBackpressureTaskCancellationStats: + type: object + properties: + cancellation_count: + type: number + cancellation_limit_reached_count: + type: number + TotalRejectionsBreakupShadowMode: + type: object + properties: + node_limits: + type: number + no_successful_request_limits: + type: number + throughput_degradation_limits: + type: number IndexingPressureMemory: type: object properties: diff --git a/tests/nodes/stats.yaml b/tests/nodes/stats.yaml new file mode 100644 index 000000000..aab5dfdc0 --- /dev/null +++ b/tests/nodes/stats.yaml @@ -0,0 +1,9 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test nodes stats. +chapters: + - synopsis: Get all nodes stats. + path: /_nodes/stats + method: GET + response: + status: 200 From b2af866682ee86360ba509d527075e398ad3d50f Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Mon, 15 Jul 2024 18:09:28 -0500 Subject: [PATCH 3/6] Removed one of the duplicate '/_nodes/{metric}' and '/_nodes/{node_id}' paths. (#416) * Removed one of the duplicate '/_nodes/{metric}' and '/_nodes/{node_id}' paths. Signed-off-by: dblock * Allow either node ID or metric in /_nodes. Signed-off-by: dblock * Added tests across namespace. Signed-off-by: dblock * Added title to optional refs. Signed-off-by: dblock * Fix metric schema. Co-authored-by: Thomas Farr Signed-off-by: Daniel (dB.) Doubrovkine * Updated client generator guide. Signed-off-by: dblock * Removed dup parts. Signed-off-by: dblock --------- Signed-off-by: dblock Signed-off-by: Daniel (dB.) Doubrovkine Co-authored-by: Thomas Farr --- CHANGELOG.md | 1 + CLIENT_GENERATOR_GUIDE.md | 30 +++++++++++- spec/namespaces/nodes.yaml | 47 ++++++++++--------- .../src/linter/components/NamespacesFolder.ts | 23 +++++++-- tools/tests/linter/NamespacesFolder.test.ts | 10 ++++ .../namespaces/invalid_folder/dup_path_d.yaml | 3 ++ .../invalid_folder/dup_path_namespace_a.yaml | 6 +++ .../invalid_folder/dup_path_namespace_b.yaml | 6 +++ 8 files changed, 97 insertions(+), 29 deletions(-) create mode 100644 tools/tests/linter/fixtures/folder_validators/namespaces/invalid_folder/dup_path_d.yaml create mode 100644 tools/tests/linter/fixtures/folder_validators/namespaces/invalid_folder/dup_path_namespace_a.yaml create mode 100644 tools/tests/linter/fixtures/folder_validators/namespaces/invalid_folder/dup_path_namespace_b.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index aa524b549..e81b172ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Fixed `/_data_stream` health status and required fields ([#401](https://github.com/opensearch-project/opensearch-api-specification/pull/401)) - Fixed query DSL `match` that supports a field name and value ([#405](https://github.com/opensearch-project/opensearch-api-specification/pull/405)) - Fixed `/_mapping` with `index` in query ([#385](https://github.com/opensearch-project/opensearch-api-specification/pull/385)) +- Fixed duplicate `/_nodes/{node_id}` path ([#416](https://github.com/opensearch-project/opensearch-api-specification/pull/416)) ### Security diff --git a/CLIENT_GENERATOR_GUIDE.md b/CLIENT_GENERATOR_GUIDE.md index 29077c229..84ea7beb7 100644 --- a/CLIENT_GENERATOR_GUIDE.md +++ b/CLIENT_GENERATOR_GUIDE.md @@ -1,3 +1,12 @@ +- [Generate Clients for OpenSearch using OpenAPI Specification](#generate-clients-for-opensearch-using-openapi-specification) + - [The Grouping of API Operations](#the-grouping-of-api-operations) + - [Overloaded Name](#overloaded-name) + - [Handling Bulk Operations](#handling-bulk-operations) + - [Parameter Validation](#parameter-validation) + - [Global Parameters](#global-parameters) + - [Default Parameter Values](#default-parameter-values) + - [Duplicate Paths](#duplicate-paths) + # Generate Clients for OpenSearch using OpenAPI Specification OpenSearch Clients are available in multiple programming languages. The biggest challenge with this is keeping the clients up to date with the latest changes in OpenSearch. To solve this problem, we're automating the process of generating clients for OpenSearch using the OpenAPI specification. While OpenAPI comes with many well established off-the-shelf client generators for most languages, the OpenSearch APIs come with a lot of quirkiness that makes it near impossible to use these off-the-shelf generators. For this reason, we've opted to write our own client generators that is specifically tailored to the OpenSearch APIs. This document will walk you through the process of generating clients from [the published OpenSearch OpenAPI spec](https://github.com/opensearch-project/opensearch-api-specification/releases), more specifically client API methods. @@ -58,4 +67,23 @@ Some clients also check for the validity of query string parameter names to guar All operations in the spec contain a set of parameters that are common across all operations. These parameters are denoted with `x-global: true` vendor extension. The generated clients should find a way to DRY these parameters in type definitions and method documentation. ## Default Parameter Values -Parameters can have default values either through schema or the `x-default` vendor extension. When both are present, `x-default` will take precedence. \ No newline at end of file +Parameters can have default values either through schema or the `x-default` vendor extension. When both are present, `x-default` will take precedence. + +## Duplicate Paths +OpenAPI does not allow duplicate paths, which makes it challenging to express certain OpenSearch APIs, such as `/_nodes/{node_id}` and `/_nodes/{metric}`. In this example the server expects either a `node_id` or a `metric`. The API specification handles this by defining a `/_nodes/{node_id_or_metric}` path, and decorating the `node_id_or_metric` type with a `title` field. + +```yaml +name: node_id_or_metric +schema: +anyOf: + - title: node_id + $ref: '../schemas/_common.yaml#/components/schemas/NodeIds' + - title: metric + type: array + items: + $ref: '../schemas/nodes.info.yaml#/components/schemas/Metric' +``` + +See [#416](https://github.com/opensearch-project/opensearch-api-specification/pull/416) for a complete example. + +Clients should generate multiple methods or a method that accepts multiple parameters in this case. diff --git a/spec/namespaces/nodes.yaml b/spec/namespaces/nodes.yaml index 4db9ebfee..e99653b12 100644 --- a/spec/namespaces/nodes.yaml +++ b/spec/namespaces/nodes.yaml @@ -253,7 +253,7 @@ paths: responses: '200': $ref: '#/components/responses/nodes.usage@200' - /_nodes/{metric}: + /_nodes/{node_id_or_metric}: get: operationId: nodes.info.1 x-operation-group: nodes.info @@ -262,22 +262,7 @@ paths: externalDocs: url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-info/ parameters: - - $ref: '#/components/parameters/nodes.info::path.metric' - - $ref: '#/components/parameters/nodes.info::query.flat_settings' - - $ref: '#/components/parameters/nodes.info::query.timeout' - responses: - '200': - $ref: '#/components/responses/nodes.info@200' - /_nodes/{node_id}: - get: - operationId: nodes.info.2 - x-operation-group: nodes.info - x-version-added: '1.0' - description: Returns information about nodes in the cluster. - externalDocs: - url: https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-info/ - parameters: - - $ref: '#/components/parameters/nodes.info::path.node_id' + - $ref: '#/components/parameters/nodes.info::path.node_id_or_metric' - $ref: '#/components/parameters/nodes.info::query.flat_settings' - $ref: '#/components/parameters/nodes.info::query.timeout' responses: @@ -545,15 +530,21 @@ components: description: The type to sample. schema: $ref: '../schemas/nodes._common.yaml#/components/schemas/SampleType' - nodes.info::path.metric: + nodes.info::path.node_id_or_metric: in: path - name: metric - description: Limits the information returned to the specific metrics. Supports a comma-separated list, such as http,ingest. + name: node_id_or_metric + description: | + Limits the information returned to a list of node IDs or specific metrics. + Supports a comma-separated list, such as node1,node2 or http,ingest. required: true schema: - type: array - items: - $ref: '../schemas/nodes.info.yaml#/components/schemas/Metric' + anyOf: + - title: node_id + $ref: '../schemas/_common.yaml#/components/schemas/NodeIds' + - title: metric + type: array + items: + $ref: '../schemas/nodes.info.yaml#/components/schemas/Metric' style: simple nodes.info::path.node_id: in: path @@ -563,6 +554,16 @@ components: schema: $ref: '../schemas/_common.yaml#/components/schemas/NodeIds' style: simple + nodes.info::path.metric: + in: path + name: metric + description: Limits the information returned to the specific metrics. Supports a comma-separated list, such as http,ingest. + required: true + schema: + type: array + items: + $ref: '../schemas/nodes.info.yaml#/components/schemas/Metric' + style: simple nodes.info::query.flat_settings: in: query name: flat_settings diff --git a/tools/src/linter/components/NamespacesFolder.ts b/tools/src/linter/components/NamespacesFolder.ts index d7ebf4371..71507f7c1 100644 --- a/tools/src/linter/components/NamespacesFolder.ts +++ b/tools/src/linter/components/NamespacesFolder.ts @@ -10,6 +10,7 @@ import NamespaceFile from './NamespaceFile' import { type ValidationError } from 'types' import FolderValidator from './base/FolderValidator' +import _ from 'lodash' export default class NamespacesFolder extends FolderValidator { constructor (folder_path: string) { @@ -21,16 +22,28 @@ export default class NamespacesFolder extends FolderValidator { } validate_duplicate_paths (): ValidationError[] { - const paths: Record = {} + const paths: Record = {} for (const file of this.files) { if (file.spec().paths == null) continue Object.keys(file.spec().paths).sort().forEach((path) => { - if (paths[path] == null) paths[path] = [file.namespace] - else paths[path].push(file.namespace) + const normalized_path = path.replaceAll(/\{[^}]+}/g, '{}') + const path_entry = { + path, + namespace: file.namespace + } + if (paths[normalized_path] == null) { + paths[normalized_path] = [path_entry] + } else { + paths[normalized_path].push(path_entry) + } }) } - return Object.entries(paths).map(([path, namespaces]) => { - if (namespaces.length > 1) { return this.error(`Duplicate path '${path}' found in namespaces: ${namespaces.sort().join(', ')}.`) } + return Object.entries(paths).map(([_normalized_path, namespaces]) => { + if (namespaces.length > 1) { + const dup_paths = _.uniq(_.map(namespaces, (entry) => { return `'${entry.path}'` })) + const dup_namespaces = _.uniq(_.map(namespaces, (entry) => entry.namespace)) + return this.error(`Duplicate path${dup_paths.length > 1 ? 's' : ''} ${_.join(dup_paths, ', ')} found in namespace${dup_namespaces.length > 1 ? 's' : ''}: ${_.join(dup_namespaces, ', ')}.`) + } }).filter((e) => e) as ValidationError[] } } diff --git a/tools/tests/linter/NamespacesFolder.test.ts b/tools/tests/linter/NamespacesFolder.test.ts index 35b48babc..92f7dc94b 100644 --- a/tools/tests/linter/NamespacesFolder.test.ts +++ b/tools/tests/linter/NamespacesFolder.test.ts @@ -56,6 +56,16 @@ describe('validate()', () => { file: 'invalid_folder/', location: 'Folder', message: "Duplicate path '/{index}/_rollover' found in namespaces: dup_path_a, dup_path_b, dup_path_c." + }, + { + file: 'invalid_folder/', + location: 'Folder', + message: "Duplicate paths '/nodes/{metric}', '/nodes/{node_id}' found in namespace: dup_path_d." + }, + { + file: 'invalid_folder/', + location: 'Folder', + message: "Duplicate paths '/indices/{metric}', '/indices/{node_id}' found in namespaces: dup_path_namespace_a, dup_path_namespace_b." } ]) }) diff --git a/tools/tests/linter/fixtures/folder_validators/namespaces/invalid_folder/dup_path_d.yaml b/tools/tests/linter/fixtures/folder_validators/namespaces/invalid_folder/dup_path_d.yaml new file mode 100644 index 000000000..200678921 --- /dev/null +++ b/tools/tests/linter/fixtures/folder_validators/namespaces/invalid_folder/dup_path_d.yaml @@ -0,0 +1,3 @@ +paths: + '/nodes/{metric}': {} + '/nodes/{node_id}': {} diff --git a/tools/tests/linter/fixtures/folder_validators/namespaces/invalid_folder/dup_path_namespace_a.yaml b/tools/tests/linter/fixtures/folder_validators/namespaces/invalid_folder/dup_path_namespace_a.yaml new file mode 100644 index 000000000..88c1dc7c6 --- /dev/null +++ b/tools/tests/linter/fixtures/folder_validators/namespaces/invalid_folder/dup_path_namespace_a.yaml @@ -0,0 +1,6 @@ +openapi: 3.1.0 +info: + title: OpenSearch Indices API (Namespace 1) + version: 1.0.0 +paths: + '/indices/{metric}': {} diff --git a/tools/tests/linter/fixtures/folder_validators/namespaces/invalid_folder/dup_path_namespace_b.yaml b/tools/tests/linter/fixtures/folder_validators/namespaces/invalid_folder/dup_path_namespace_b.yaml new file mode 100644 index 000000000..6e8dcd79c --- /dev/null +++ b/tools/tests/linter/fixtures/folder_validators/namespaces/invalid_folder/dup_path_namespace_b.yaml @@ -0,0 +1,6 @@ +openapi: 3.1.0 +info: + title: OpenSearch Indices API (Namespace 2) + version: 1.0.0 +paths: + '/indices/{node_id}': {} From 9c15bbf1522b1604e2e36f16b53163413f5fe833 Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Mon, 15 Jul 2024 19:32:10 -0500 Subject: [PATCH 4/6] Added metrics to _nodes/stats. (#422) Signed-off-by: dblock --- CHANGELOG.md | 1 + spec/schemas/nodes.stats.yaml | 15 ++++ tests/nodes/info.yaml | 9 +- tests/nodes/stats.yaml | 149 +++++++++++++++++++++++++++++++++- 4 files changed, 172 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e81b172ef..e170d4005 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added support for skipping tests using semver range ([#410](https://github.com/opensearch-project/opensearch-api-specification/pull/410)) - Added `cluster_manager_timeout` to `HEAD /{index}` ([#421](https://github.com/opensearch-project/opensearch-api-specification/pull/421)) - Added missing fields to `/_nodes/stats` ([#415](https://github.com/opensearch-project/opensearch-api-specification/pull/415)) +- Added missing metrics options to `/_nodes/stats` ([#422](https://github.com/opensearch-project/opensearch-api-specification/pull/422)) ### Changed diff --git a/spec/schemas/nodes.stats.yaml b/spec/schemas/nodes.stats.yaml index 63d877d34..52dd278d0 100644 --- a/spec/schemas/nodes.stats.yaml +++ b/spec/schemas/nodes.stats.yaml @@ -10,18 +10,33 @@ components: type: string enum: - _all + - adaptive_selection + - admission_control - breaker + - caches + - cluster_manager_throttling - discovery + - file_cache - fs - http - indexing_pressure - indices + - ingest - jvm - os - process + - repositories + - resource_usage_stats + - script + - script_cache + - search_backpressure - search_pipeline + - segment_replication_backpressure + - shard_indexing_pressure + - task_cancellation - thread_pool - transport + - weighted_routing IndexMetric: type: string enum: diff --git a/tests/nodes/info.yaml b/tests/nodes/info.yaml index 608232cb3..362a04803 100644 --- a/tests/nodes/info.yaml +++ b/tests/nodes/info.yaml @@ -2,8 +2,15 @@ $schema: ../../json_schemas/test_story.schema.yaml description: Test nodes endpoints. chapters: - - synopsis: Nodes with a json response. + - synopsis: Get all nodes. path: /_nodes method: GET response: status: 200 + - synopsis: Get nodes. + path: /_nodes/{node_id_or_metric} + method: GET + parameters: + node_id_or_metric: indices + response: + status: 200 diff --git a/tests/nodes/stats.yaml b/tests/nodes/stats.yaml index aab5dfdc0..212a58c22 100644 --- a/tests/nodes/stats.yaml +++ b/tests/nodes/stats.yaml @@ -2,8 +2,155 @@ $schema: ../../json_schemas/test_story.schema.yaml description: Test nodes stats. chapters: - - synopsis: Get all nodes stats. + - synopsis: Get stats for all nodes. path: /_nodes/stats method: GET response: status: 200 + - synopsis: Get stats for all nodes with parameters. + path: /_nodes/stats + method: GET + parameters: + completion_fields: '*' + fielddata_fields: '*' + fields: '*' + groups: + - '*' + timeout: 10s + include_segment_file_sizes: true + response: + status: 200 + - synopsis: Get _all node stats (node_id). + path: /_nodes/{node_id}/stats + method: GET + parameters: + node_id: _all + response: + status: 200 + - synopsis: Get fs metic node stats (metric). + path: /_nodes/stats/{metric} + method: GET + parameters: + metric: + - fs + response: + status: 200 + - synopsis: Get fs metric node stats (node_id_or_metric). + path: /_nodes/{node_id_or_metric} + method: GET + parameters: + node_id_or_metric: fs + response: + status: 200 + - synopsis: Get jvm and fs metric node stats from data nodes. + path: /_nodes/{node_id}/stats/{metric} + method: GET + parameters: + node_id: data:true + metric: + - fs + - jvm + response: + status: 200 + - synopsis: Get statistics for the request_cache. + path: /_nodes/stats/{metric}/{index_metric} + method: GET + parameters: + metric: + - adaptive_selection + - breaker + - discovery + - fs + - http + - indexing_pressure + - indices + - ingest + - jvm + - os + - process + - script + - script_cache + - shard_indexing_pressure + - thread_pool + - transport + index_metric: + - request_cache + response: + status: 200 + - synopsis: Get statistics for the request_cache (2.4). + path: /_nodes/stats/{metric}/{index_metric} + method: GET + version: '>= 2.4' + parameters: + metric: + - indices + - search_backpressure + index_metric: + - request_cache + response: + status: 200 + - synopsis: Get statistics for the request_cache (2.6). + path: /_nodes/stats/{metric}/{index_metric} + method: GET + version: '>= 2.6' + parameters: + metric: + - cluster_manager_throttling + - indices + - weighted_routing + index_metric: + - request_cache + response: + status: 200 + - synopsis: Get statistics for the request_cache (2.7). + path: /_nodes/stats/{metric}/{index_metric} + method: GET + version: '>= 2.7' + parameters: + metric: + - file_cache + - indices + index_metric: + - request_cache + response: + status: 200 + - synopsis: Get statistics for the request_cache (2.9). + path: /_nodes/stats/{metric}/{index_metric} + method: GET + version: '>= 2.9' + parameters: + metric: + - indices + - search_pipeline + - task_cancellation + index_metric: + - request_cache + response: + status: 200 + - synopsis: Get statistics for the request_cache (2.12). + path: /_nodes/stats/{metric}/{index_metric} + method: GET + version: '>= 2.12' + parameters: + metric: + - admission_control + - indices + - repositories + - resource_usage_stats + - segment_replication_backpressure + index_metric: + - request_cache + response: + status: 200 + - synopsis: Get statistics for the request_cache (2.14). + path: /_nodes/stats/{metric}/{index_metric} + method: GET + version: '>= 2.14' + parameters: + metric: + - caches + - indices + index_metric: + - request_cache + response: + status: 200 \ No newline at end of file From 0c590334962481bde032f6c7ee9089db286fb4f5 Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Tue, 16 Jul 2024 11:49:41 -0500 Subject: [PATCH 5/6] Test against OpenSearch 1.3.17. (#424) Signed-off-by: dblock --- .github/workflows/test-spec.yml | 1 + CHANGELOG.md | 1 + spec/schemas/_common.yaml | 5 +++++ spec/schemas/_core.bulk.yaml | 4 ++++ spec/schemas/_core.get.yaml | 2 ++ spec/schemas/_core.search.yaml | 2 ++ spec/schemas/cat.health.yaml | 4 ++++ tests/cat/cluster_manager.yaml | 1 + tests/cat/health.yaml | 30 ++++++++++++++++++++++++--- tests/cat/master.yaml | 12 +++++++++++ tests/cat/nodes.yaml | 11 ++++++++++ tests/cluster/component_template.yaml | 18 +++++++++++++++- tests/indices/clone.yaml | 14 ++++++++++++- tests/indices/close.yaml | 21 ++++++++++++++++++- tests/indices/index.yaml | 18 ++++++++++++++++ tests/indices/index_template.yaml | 8 +++++++ tests/indices/mapping.yml | 17 ++++++++++++++- tests/indices/open.yaml | 21 +++++++++++++++++-- tests/indices/settings.yaml | 13 ++++++++++++ tests/indices/shrink.yaml | 21 +++++++++++++++++-- tests/indices/split.yaml | 26 +++++++++++++++++++++-- 21 files changed, 237 insertions(+), 13 deletions(-) create mode 100644 tests/cat/master.yaml diff --git a/.github/workflows/test-spec.yml b/.github/workflows/test-spec.yml index 3769aa126..7938d925e 100644 --- a/.github/workflows/test-spec.yml +++ b/.github/workflows/test-spec.yml @@ -23,6 +23,7 @@ jobs: strategy: matrix: entry: + - {version: 1.3.17, admin_password: admin} - {version: 2.0.0, admin_password: admin} - {version: 2.15.0} - {version: 2.16.0, hub: opensearchstaging} diff --git a/CHANGELOG.md b/CHANGELOG.md index e170d4005..c417fbdad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added `cluster_manager_timeout` to `HEAD /{index}` ([#421](https://github.com/opensearch-project/opensearch-api-specification/pull/421)) - Added missing fields to `/_nodes/stats` ([#415](https://github.com/opensearch-project/opensearch-api-specification/pull/415)) - Added missing metrics options to `/_nodes/stats` ([#422](https://github.com/opensearch-project/opensearch-api-specification/pull/422)) +- Added tests against OpenSearch 1.3 ([#424](https://github.com/opensearch-project/opensearch-api-specification/pull/424)) ### Changed diff --git a/spec/schemas/_common.yaml b/spec/schemas/_common.yaml index 9821b6c6d..b080de313 100644 --- a/spec/schemas/_common.yaml +++ b/spec/schemas/_common.yaml @@ -6,6 +6,9 @@ info: paths: {} components: schemas: + Type: + type: string + x-version-removed: '2.0' Id: type: string AcknowledgedResponseBase: @@ -1315,6 +1318,8 @@ components: WriteResponseBase: type: object properties: + _type: + $ref: '#/components/schemas/Type' _id: $ref: '#/components/schemas/Id' _index: diff --git a/spec/schemas/_core.bulk.yaml b/spec/schemas/_core.bulk.yaml index 90bac8a39..a4e03fd19 100644 --- a/spec/schemas/_core.bulk.yaml +++ b/spec/schemas/_core.bulk.yaml @@ -110,6 +110,10 @@ components: ResponseItem: type: object properties: + _type: + description: The document type. + type: string + x-version-removed: '2.0' _id: description: The document ID associated with the operation. anyOf: diff --git a/spec/schemas/_core.get.yaml b/spec/schemas/_core.get.yaml index 947aad4fc..42f70ce2a 100644 --- a/spec/schemas/_core.get.yaml +++ b/spec/schemas/_core.get.yaml @@ -9,6 +9,8 @@ components: GetResult: type: object properties: + _type: + $ref: '_common.yaml#/components/schemas/Type' _index: $ref: '_common.yaml#/components/schemas/IndexName' fields: diff --git a/spec/schemas/_core.search.yaml b/spec/schemas/_core.search.yaml index 5ec0b7813..8e7350d06 100644 --- a/spec/schemas/_core.search.yaml +++ b/spec/schemas/_core.search.yaml @@ -43,6 +43,8 @@ components: Hit: type: object properties: + _type: + $ref: '_common.yaml#/components/schemas/Type' _index: $ref: '_common.yaml#/components/schemas/IndexName' _id: diff --git a/spec/schemas/cat.health.yaml b/spec/schemas/cat.health.yaml index f6989038b..6e7afc949 100644 --- a/spec/schemas/cat.health.yaml +++ b/spec/schemas/cat.health.yaml @@ -52,3 +52,7 @@ components: discovered_cluster_manager: description: cluster manager is discovered or not type: string + discovered_master: + x-version-removed: '2.0' + description: cluster manager is discovered or not + type: string diff --git a/tests/cat/cluster_manager.yaml b/tests/cat/cluster_manager.yaml index ab27df451..3f0686d32 100644 --- a/tests/cat/cluster_manager.yaml +++ b/tests/cat/cluster_manager.yaml @@ -3,6 +3,7 @@ $schema: ../../json_schemas/test_story.schema.yaml description: Test cat/cluster_manager endpoints. chapters: - synopsis: Cat with a json response. + version: '>= 2.0' path: /_cat/cluster_manager method: GET parameters: diff --git a/tests/cat/health.yaml b/tests/cat/health.yaml index 35d1713b6..cc18865be 100644 --- a/tests/cat/health.yaml +++ b/tests/cat/health.yaml @@ -46,6 +46,33 @@ chapters: - synopsis: Cat in different formats (format=json). method: GET path: /_cat/health + parameters: + format: json + response: + status: 200 + content_type: application/json + payload: + - node.total: '1' + status: yellow + node.data: '1' + - synopsis: Cat with master response (format=json). + method: GET + path: /_cat/health + version: < 2.0 + parameters: + format: json + response: + status: 200 + content_type: application/json + payload: + - node.total: '1' + status: yellow + node.data: '1' + discovered_master: 'true' + - synopsis: Cat with cluster_manager response (format=json). + method: GET + path: /_cat/health + version: '>= 2.0' parameters: format: json response: @@ -68,7 +95,6 @@ chapters: - node.total: '1' status: yellow node.data: '1' - discovered_cluster_manager: 'true' - synopsis: Cat in different formats (format=cbor). method: GET path: /_cat/health @@ -81,7 +107,6 @@ chapters: - node.total: '1' status: yellow node.data: '1' - discovered_cluster_manager: 'true' - synopsis: Cat in different formats (format=smile). method: GET path: /_cat/health @@ -94,4 +119,3 @@ chapters: - node.total: '1' status: yellow node.data: '1' - discovered_cluster_manager: 'true' \ No newline at end of file diff --git a/tests/cat/master.yaml b/tests/cat/master.yaml new file mode 100644 index 000000000..b1ed7985b --- /dev/null +++ b/tests/cat/master.yaml @@ -0,0 +1,12 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test cat/master endpoints. +chapters: + - synopsis: Cat with a json response. + version: < 2.0 + path: /_cat/master + method: GET + parameters: + format: json + response: + status: 200 diff --git a/tests/cat/nodes.yaml b/tests/cat/nodes.yaml index ab484e295..919100791 100644 --- a/tests/cat/nodes.yaml +++ b/tests/cat/nodes.yaml @@ -5,6 +5,17 @@ chapters: - synopsis: Cat with a json response. path: /_cat/nodes method: GET + version: < 2.0 + parameters: + format: json + response: + status: 200 + payload: + - master: '*' + - synopsis: Cat with a json response. + path: /_cat/nodes + version: '>= 2.0' + method: GET parameters: format: json response: diff --git a/tests/cluster/component_template.yaml b/tests/cluster/component_template.yaml index 78ba7eea4..05838d5db 100644 --- a/tests/cluster/component_template.yaml +++ b/tests/cluster/component_template.yaml @@ -53,13 +53,29 @@ chapters: method: HEAD parameters: name: template1 - cluster_manager_timeout: 10s local: false response: status: 200 + - synopsis: Check if the component template exists (cluster_manager_timeout). + path: /_component_template/{name} + method: HEAD + version: '>= 2.0' + parameters: + name: template1 + cluster_manager_timeout: 10s + response: + status: 200 - synopsis: Get all component templates. path: /_component_template method: GET + parameters: + local: false + response: + status: 200 + - synopsis: Get all component templates (cluster_manager_timeout). + path: /_component_template + method: GET + version: '>= 2.0' parameters: cluster_manager_timeout: 10s local: false diff --git a/tests/indices/clone.yaml b/tests/indices/clone.yaml index e1d88d74d..cf0e5fcfc 100644 --- a/tests/indices/clone.yaml +++ b/tests/indices/clone.yaml @@ -14,6 +14,9 @@ epilogues: - path: /games2 method: DELETE status: [200, 404] + - path: /games3 + method: DELETE + status: [200, 404] chapters: - synopsis: Block writes to the source index. path: /{index}/_settings @@ -31,7 +34,6 @@ chapters: index: movies target: games1 wait_for_active_shards: 1 - cluster_manager_timeout: 10s timeout: 10s response: status: 200 @@ -49,3 +51,13 @@ chapters: wait_for_completion: true response: status: 200 + - synopsis: Clone an index (cluster_manager_timeout). + version: '>= 2.0' + path: /{index}/_clone/{target} + method: POST + parameters: + index: movies + target: games3 + cluster_manager_timeout: 10s + response: + status: 200 diff --git a/tests/indices/close.yaml b/tests/indices/close.yaml index 0766f3085..ca0a517d9 100644 --- a/tests/indices/close.yaml +++ b/tests/indices/close.yaml @@ -5,10 +5,16 @@ prologues: - path: /movies method: PUT status: [200] + - path: /games + method: PUT + status: [200] epilogues: - path: /movies method: DELETE status: [200, 404] + - path: /games + method: DELETE + status: [200, 404] chapters: - synopsis: Close an index. path: /{index}/_close @@ -19,7 +25,6 @@ chapters: expand_wildcards: all ignore_unavailable: true wait_for_active_shards: 0 - cluster_manager_timeout: 30s timeout: 30s response: status: 200 @@ -27,6 +32,20 @@ chapters: indices: movies: closed: true + - synopsis: Close an index (cluster_manager_timeout). + path: /{index}/_close + method: POST + version: '>= 2.0' + parameters: + index: games + cluster_manager_timeout: 30s + timeout: 30s + response: + status: 200 + payload: + indices: + games: + closed: true - synopsis: Close an already closed index. path: /{index}/_close method: POST diff --git a/tests/indices/index.yaml b/tests/indices/index.yaml index e91becc8e..c9302a288 100644 --- a/tests/indices/index.yaml +++ b/tests/indices/index.yaml @@ -49,6 +49,15 @@ chapters: - synopsis: Check if the index `movies` exists. It should not. path: /{index} method: HEAD + parameters: + index: movies + response: + status: 404 + + - synopsis: Check if the index `movies` exists (cluster_manager_timeout). It should not. + path: /{index} + method: HEAD + version: '>= 2.0' parameters: index: movies cluster_manager_timeout: 10s @@ -77,6 +86,15 @@ chapters: - synopsis: Delete the `books` and `games` indices. path: /{index} method: DELETE + version: < 2.0 + parameters: + index: books,games + + - synopsis: Delete the `books` index (cluster_manager_timeout). + path: /{index} + method: DELETE + version: '>= 2.0' parameters: index: books,games cluster_manager_timeout: 10s + diff --git a/tests/indices/index_template.yaml b/tests/indices/index_template.yaml index 645312864..c61011894 100644 --- a/tests/indices/index_template.yaml +++ b/tests/indices/index_template.yaml @@ -65,6 +65,14 @@ chapters: - synopsis: Check that an index template exists. path: /_index_template/{name} method: HEAD + parameters: + name: daily_logs + response: + status: 200 + - synopsis: Check that an index template exists (cluster_manager_timeout). + path: /_index_template/{name} + method: HEAD + version: '>= 2.0' parameters: name: daily_logs cluster_manager_timeout: 10s diff --git a/tests/indices/mapping.yml b/tests/indices/mapping.yml index d91ed48b1..4d4860f05 100644 --- a/tests/indices/mapping.yml +++ b/tests/indices/mapping.yml @@ -66,7 +66,6 @@ chapters: allow_no_indices: true expand_wildcards: none ignore_unavailable: true - cluster_manager_timeout: 1s timeout: 10s write_index_only: true request_body: @@ -78,3 +77,19 @@ chapters: status: 200 payload: acknowledged: true + - synopsis: Update mapping for an index (cluster_manager_timeout). + path: /{index}/_mapping + method: PUT + version: '>= 2.0' + parameters: + index: movies + cluster_manager_timeout: 1s + request_body: + payload: + properties: + producer: + type: text + response: + status: 200 + payload: + acknowledged: true \ No newline at end of file diff --git a/tests/indices/open.yaml b/tests/indices/open.yaml index e69d9802a..61aa6fc4b 100644 --- a/tests/indices/open.yaml +++ b/tests/indices/open.yaml @@ -8,14 +8,20 @@ prologues: - path: /games method: PUT status: [200] + - path: /films + method: PUT + status: [200] - path: /movies/_close method: POST status: [200] - path: /games/_close method: POST status: [200] + - path: /films/_close + method: POST + status: [200] epilogues: - - path: /movies,games + - path: /movies,games,films method: DELETE status: [200, 404] chapters: @@ -28,7 +34,6 @@ chapters: expand_wildcards: all ignore_unavailable: true wait_for_active_shards: 0 - cluster_manager_timeout: 30s timeout: 30s response: status: 200 @@ -54,3 +59,15 @@ chapters: payload: shards_acknowledged: true acknowledged: true + - synopsis: Open a closed index (cluster_manager_timeout). + path: /{index}/_open + method: POST + version: '>= 2.0' + parameters: + index: films + cluster_manager_timeout: 30s + response: + status: 200 + payload: + shards_acknowledged: true + acknowledged: true \ No newline at end of file diff --git a/tests/indices/settings.yaml b/tests/indices/settings.yaml index e690fc253..dc5a85f7b 100644 --- a/tests/indices/settings.yaml +++ b/tests/indices/settings.yaml @@ -13,6 +13,19 @@ chapters: - synopsis: Get global settings. path: /_settings method: GET + parameters: + allow_no_indices: true + expand_wildcards: none + flat_settings: true + include_defaults: true + ignore_unavailable: true + local: true + response: + status: 200 + - synopsis: Get global settings (cluster_manager_timeout). + path: /_settings + method: GET + version: '>= 2.0' parameters: allow_no_indices: true expand_wildcards: none diff --git a/tests/indices/shrink.yaml b/tests/indices/shrink.yaml index db83a4954..bfa798487 100644 --- a/tests/indices/shrink.yaml +++ b/tests/indices/shrink.yaml @@ -21,6 +21,9 @@ epilogues: - path: /movies3 method: DELETE status: [200, 404] + - path: /movies4 + method: DELETE + status: [200, 404] chapters: - synopsis: Block writes to the source index. path: /{index}/_settings @@ -38,7 +41,6 @@ chapters: index: movies target: movies1 wait_for_active_shards: 1 - cluster_manager_timeout: 10s timeout: 10s response: status: 200 @@ -63,6 +65,21 @@ chapters: index: movies target: movies3 wait_for_active_shards: 1 + timeout: 10s + response: + status: 200 + payload: + shards_acknowledged: true + acknowledged: true + index: movies3 + - synopsis: Shrink an index (cluster_manager_timeout). + path: /{index}/_shrink/{target} + method: POST + version: '>= 2.0' + parameters: + index: movies + target: movies4 + wait_for_active_shards: 1 cluster_manager_timeout: 10s timeout: 10s response: @@ -70,4 +87,4 @@ chapters: payload: shards_acknowledged: true acknowledged: true - index: movies3 \ No newline at end of file + index: movies4 diff --git a/tests/indices/split.yaml b/tests/indices/split.yaml index 41ca8053c..626edd8ee 100644 --- a/tests/indices/split.yaml +++ b/tests/indices/split.yaml @@ -21,6 +21,9 @@ epilogues: - path: /movies3 method: DELETE status: [200, 404] + - path: /movies4 + method: DELETE + status: [200, 404] chapters: - synopsis: Block writes to the source index. path: /{index}/_settings @@ -38,7 +41,6 @@ chapters: index: movies target: movies1 wait_for_active_shards: 1 - cluster_manager_timeout: 10s timeout: 10s request_body: payload: @@ -73,6 +75,26 @@ chapters: index: movies target: movies3 wait_for_active_shards: 1 + timeout: 10s + request_body: + payload: + settings: + index: + number_of_shards: 6 + response: + status: 200 + payload: + shards_acknowledged: true + acknowledged: true + index: movies3 + - synopsis: Split an index (cluster_manager_timeout). + path: /{index}/_split/{target} + method: POST + version: '>= 2.0' + parameters: + index: movies + target: movies4 + wait_for_active_shards: 1 cluster_manager_timeout: 10s timeout: 10s request_body: @@ -85,4 +107,4 @@ chapters: payload: shards_acknowledged: true acknowledged: true - index: movies3 \ No newline at end of file + index: movies4 \ No newline at end of file From 6627ca7d8517420d46124984344bf15b72c5bd89 Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Tue, 16 Jul 2024 16:45:59 -0500 Subject: [PATCH 6/6] Moved .md files around for consistency. (#426) Signed-off-by: dblock --- CHANGELOG.md | 2 +- DEVELOPER_GUIDE.md | 2 +- PUBLISHING_SPECS.md => PUBLISHING_GUIDE.md | 0 README.md | 29 +++++--------------- SPECIFICATION_TESTING.md => TESTING_GUIDE.md | 4 +-- 5 files changed, 11 insertions(+), 26 deletions(-) rename PUBLISHING_SPECS.md => PUBLISHING_GUIDE.md (100%) rename SPECIFICATION_TESTING.md => TESTING_GUIDE.md (98%) diff --git a/CHANGELOG.md b/CHANGELOG.md index c417fbdad..004de5615 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added tests for response payload ([#347](https://github.com/opensearch-project/opensearch-api-specification/pull/347)) - Added `cancel_after_time_interval` and `phase_took` in `_search` ([#353](https://github.com/opensearch-project/opensearch-api-specification/pull/353)) - Added support for testing `application/x-ndjson` payloads ([#355](https://github.com/opensearch-project/opensearch-api-specification/pull/355)) -- Added SPECIFICATION_TESTING.md [#359](https://github.com/opensearch-project/opensearch-api-specification/pull/359) +- Added TESTING_GUIDE.md [#359](https://github.com/opensearch-project/opensearch-api-specification/pull/359) - Added StoryValidator to validate stories before running them ([#354](https://github.com/opensearch-project/opensearch-api-specification/issues/354)) - Added support for `text/plain` responses in `_cat` APIs ([#360](https://github.com/opensearch-project/opensearch-api-specification/pull/360)) - Added support for `application/yaml` responses ([#363](https://github.com/opensearch-project/opensearch-api-specification/pull/363)) diff --git a/DEVELOPER_GUIDE.md b/DEVELOPER_GUIDE.md index d86e29295..e941171c5 100644 --- a/DEVELOPER_GUIDE.md +++ b/DEVELOPER_GUIDE.md @@ -149,7 +149,7 @@ This repository includes several OpenAPI Specification Extensions to fill in any ## Writing Spec Tests -To assure the correctness of the spec, you must add tests for the spec, when making changes. Check [SPECIFICATION_TESTING.md](SPECIFICATION_TESTING.md) for more information. +To assure the correctness of the spec, you must add tests for the spec, when making changes. Check [TESTING_GUIDE.md](TESTING_GUIDE.md) for more information. ## Tools diff --git a/PUBLISHING_SPECS.md b/PUBLISHING_GUIDE.md similarity index 100% rename from PUBLISHING_SPECS.md rename to PUBLISHING_GUIDE.md diff --git a/README.md b/README.md index 9412efb1b..7b05be832 100644 --- a/README.md +++ b/README.md @@ -12,25 +12,25 @@ - [Welcome!](#welcome) - [Project Resources](#project-resources) - [Code of Conduct](#code-of-conduct) -- [Developer Guide](#developer-guide) -- [Client Generator Guide](#client-generator-guide) -- [Published Spec](#published-spec) - [Security](#security) - [License](#license) - [Copyright](#copyright) ## Welcome! -`opensearch-api-specification` is an open source, community-driven collection of API model specifications for -[OpenSearch](https://github.com/opensearch-project/OpenSearch) APIs. The API models are written in OpenAPI format and are used to generate client libraries and documentation. +The `opensearch-api-specification` is an open source, community-driven collection of API model specifications for [OpenSearch](https://github.com/opensearch-project/OpenSearch) APIs. The API models are written in OpenAPI format and are used to generate client libraries and documentation. You can find the latest version of the API specification [here](https://github.com/opensearch-project/opensearch-api-specification/releases/download/main-latest/opensearch-openapi.yaml). -To contribute to this project or to track the developments head over to [Projects](https://github.com/opensearch-project/opensearch-api-specification/projects) -board. Follow the [Developer guide](DEVELOPER_GUIDE.md) and [Contributing guidelines](CONTRIBUTING.md) for instructions +To contribute to this project or to track the developments head over to [Projects](https://github.com/opensearch-project/opensearch-api-specification/projects) board. Follow the [Developer guide](DEVELOPER_GUIDE.md) and [Contributing guidelines](CONTRIBUTING.md) for instructions on building and contributing to opensearch-api-specification. ## Project Resources +* [Current Release](https://github.com/opensearch-project/opensearch-api-specification/releases/download/main-latest/opensearch-openapi.yaml) +* [Developer Guide](DEVELOPER_GUIDE.md). +* [Client Generator Guide](CLIENT_GENERATOR_GUIDE.md). +* [Spec Publishing Guide](PUBLISHING_GUIDE.md). * [Project Website](https://opensearch.org/) +* [API Playground](https://opensearch-project.github.io/opensearch-api-specification/) * [Downloads](https://opensearch.org/downloads.html) * [Documentation](https://opensearch.org/docs/) * Need help? Try [Forums](https://forum.opensearch.org/) @@ -41,21 +41,6 @@ on building and contributing to opensearch-api-specification. This project has adopted the [Amazon Open Source Code of Conduct](CODE_OF_CONDUCT.md). For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq), or contact [opensource-codeofconduct@amazon.com](mailto:opensource-codeofconduct@amazon.com) with any additional questions or comments. -## Developer Guide - -See [DEVELOPER_GUIDE](DEVELOPER_GUIDE.md). - -## Client Generator Guide - -See [CLIENT_GENERATOR_GUIDE](CLIENT_GENERATOR_GUIDE.md). - -## Published Spec - -OpenSearch API Specs are hosted at https://opensearch-project.github.io/opensearch-api-specification/. See [PUBLISHING_SPECS](PUBLISHING_SPECS.md) for more information. - -Click [here](https://github.com/opensearch-project/opensearch-api-specification/releases/download/main-latest/opensearch-openapi.yaml) to download the latest OpenSearch OpenAPI yaml file. - - ## Security If you discover a potential security issue in this project we ask that you notify OpenSearch Security directly via email to security@opensearch.org. Please do **not** create a public GitHub issue. diff --git a/SPECIFICATION_TESTING.md b/TESTING_GUIDE.md similarity index 98% rename from SPECIFICATION_TESTING.md rename to TESTING_GUIDE.md index fd583bc11..8afc147d2 100644 --- a/SPECIFICATION_TESTING.md +++ b/TESTING_GUIDE.md @@ -1,5 +1,5 @@ -- [Specification Testing](#specification-testing) +- [Spec Testing Guide](#spec-testing-guide) - [Running Spec Tests Locally](#running-spec-tests-locally) - [Writing Spec Tests](#writing-spec-tests) - [Simple Test Story](#simple-test-story) @@ -7,7 +7,7 @@ - [Managing Versions](#managing-versions) -# Specification Testing +# Spec Testing Guide We have devised our own test framework to test the spec against an OpenSearch cluster. We're still adding more features to the framework as the needs arise, and this document will be updated accordingly. This test framework has also been integrated into the repo's CI/CD pipeline. Checkout the [test-spec](.github/workflows/test-spec.yml) workflow for more details.