Skip to content

Commit

Permalink
Added _cat tests.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Jul 2, 2024
1 parent d25459f commit 0edb266
Show file tree
Hide file tree
Showing 33 changed files with 410 additions and 28 deletions.
3 changes: 2 additions & 1 deletion .github/opensearch-cluster/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ services:
- "9600:9600"
environment:
- discovery.type=single-node
- "OPENSEARCH_INITIAL_ADMIN_PASSWORD=${OPENSEARCH_PASSWORD:-myStrongPassword123!}"
- "OPENSEARCH_INITIAL_ADMIN_PASSWORD=${OPENSEARCH_PASSWORD:-myStrongPassword123!}"
- "path.repo=/tmp/opensearch/repo"
6 changes: 3 additions & 3 deletions spec/namespaces/_core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2418,7 +2418,7 @@ components:
$ref: '../schemas/_common.query_dsl.yaml#/components/schemas/FieldAndFormat'
knn:
description: Defines the approximate kNN search to run.
oneOf:
anyOf:
- $ref: '../schemas/_common.yaml#/components/schemas/KnnQuery'
- type: array
items:
Expand All @@ -2441,7 +2441,7 @@ components:
$ref: '../schemas/_common.query_dsl.yaml#/components/schemas/QueryContainer'
rescore:
description: Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the `query` and `post_filter` phases.
oneOf:
anyOf:
- $ref: '../schemas/_core.search.yaml#/components/schemas/Rescore'
- type: array
items:
Expand Down Expand Up @@ -5470,7 +5470,7 @@ components:
name: sort
description: A comma-separated list of <field>:<direction> pairs.
schema:
oneOf:
anyOf:
- type: string
- type: array
items:
Expand Down
19 changes: 17 additions & 2 deletions spec/namespaces/cat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ paths:
responses:
'200':
$ref: '#/components/responses/cat.pending_tasks@200'
/_cat/pit_segments:
/_cat/pit_segments/{pit_id}:
get:
operationId: cat.pit_segments.0
x-operation-group: cat.pit_segments
Expand All @@ -359,6 +359,7 @@ paths:
externalDocs:
url: https://opensearch.org/docs/latest/search-plugins/point-in-time-api/
parameters:
- $ref: '#/components/parameters/cat.pit_segments::path.index'
- $ref: '#/components/parameters/cat.pit_segments::query.bytes'
- $ref: '#/components/parameters/cat.pit_segments::query.format'
- $ref: '#/components/parameters/cat.pit_segments::query.h'
Expand Down Expand Up @@ -818,6 +819,14 @@ components:
$ref: '../schemas/cat.allocation.yaml#/components/schemas/AllocationRecord'
cat.cluster_manager@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
items:
$ref: '../schemas/cat.cluster_manager.yaml#/components/schemas/ClusterManagerRecord'
cat.count@200:
description: ''
content:
Expand Down Expand Up @@ -1768,7 +1777,7 @@ components:
name: full_id
description: If `true`, return the full node ID. If `false`, return the shortened node ID.
schema:
oneOf:
anyOf:
- type: boolean
- type: string
default: false
Expand Down Expand Up @@ -1912,6 +1921,12 @@ components:
type: boolean
default: false
description: Verbose mode. Display column headers.
cat.pit_segments::path.pit_id:
name: pit_id
in: path
description: The point-in-time ID.
schema:
$ref: '../schemas/_common.yaml#/components/schemas/String'
cat.pit_segments::query.bytes:
name: bytes
in: query
Expand Down
14 changes: 7 additions & 7 deletions spec/schemas/cat.allocation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ components:
description: |-
Disk space used by the node’s shards. Does not include disk space for the translog or unassigned shards.
IMPORTANT: This metric double-counts disk space for hard-linked files, such as those created when shrinking, splitting, or cloning an index.
oneOf:
anyOf:
- $ref: '_common.yaml#/components/schemas/ByteSize'
- nullable: true
type: string
Expand All @@ -26,7 +26,7 @@ components:
OpenSearch retrieves this metric from the node’s operating system (OS).
The metric includes disk space for: OpenSearch, including the translog and unassigned shards; the node’s operating system; any other applications or files on the node.
Unlike `disk.indices`, this metric does not double-count disk space for hard-linked files.
oneOf:
anyOf:
- $ref: '_common.yaml#/components/schemas/ByteSize'
- nullable: true
type: string
Expand All @@ -35,31 +35,31 @@ components:
Free disk space available to OpenSearch.
OpenSearch retrieves this metric from the node’s operating system.
Disk-based shard allocation uses this metric to assign shards to nodes based on available disk space.
oneOf:
anyOf:
- $ref: '_common.yaml#/components/schemas/ByteSize'
- nullable: true
type: string
disk.total:
description: Total disk space for the node, including in-use and available space.
oneOf:
anyOf:
- $ref: '_common.yaml#/components/schemas/ByteSize'
- nullable: true
type: string
disk.percent:
description: Total percentage of disk space in use. Calculated as `disk.used / disk.total`.
oneOf:
anyOf:
- $ref: '_common.yaml#/components/schemas/Percentage'
- nullable: true
type: string
host:
description: Network host for the node. Set using the `network.host` setting.
oneOf:
anyOf:
- $ref: '_common.yaml#/components/schemas/Host'
- nullable: true
type: string
ip:
description: IP address and port for the node.
oneOf:
anyOf:
- $ref: '_common.yaml#/components/schemas/Ip'
- nullable: true
type: string
Expand Down
23 changes: 23 additions & 0 deletions spec/schemas/cat.cluster_manager.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
openapi: 3.1.0
info:
title: Schemas of cat.cluster_manager category
description: Schemas of cat.cluster_manager category
version: 1.0.0
paths: {}
components:
schemas:
ClusterManagerRecord:
type: object
properties:
id:
description: node id
type: string
host:
description: host name
type: string
ip:
description: ip address
type: string
node:
description: node name
type: string
8 changes: 4 additions & 4 deletions spec/schemas/cat.shards.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ components:
type: string
docs:
description: The number of documents in the shard.
oneOf:
anyOf:
- type: string
- nullable: true
type: string
store:
description: The disk space used by the shard.
oneOf:
anyOf:
- type: string
- nullable: true
type: string
ip:
description: The IP address of the node.
oneOf:
anyOf:
- type: string
- nullable: true
type: string
Expand All @@ -50,7 +50,7 @@ components:
type: string
node:
description: The name of node.
oneOf:
anyOf:
- type: string
- nullable: true
type: string
Expand Down
2 changes: 1 addition & 1 deletion spec/schemas/cat.templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ components:
type: string
version:
description: The template version.
oneOf:
anyOf:
- $ref: '_common.yaml#/components/schemas/VersionString'
- nullable: true
type: string
Expand Down
8 changes: 4 additions & 4 deletions spec/schemas/cat.thread_pool.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,25 @@ components:
type: string
core:
description: The core number of active threads allowed in a scaling thread pool.
oneOf:
anyOf:
- type: string
- nullable: true
type: string
max:
description: The maximum number of active threads allowed in a scaling thread pool.
oneOf:
anyOf:
- type: string
- nullable: true
type: string
size:
description: The number of active threads allowed in a fixed thread pool.
oneOf:
anyOf:
- type: string
- nullable: true
type: string
keep_alive:
description: The thread keep alive time.
oneOf:
anyOf:
- type: string
- nullable: true
type: string
77 changes: 77 additions & 0 deletions tests/_core/aliases.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
$schema: ../../json_schemas/test_story.schema.yaml

description: Test aliases endpoints.
epilogues:
- path: /games
method: DELETE
status: [200, 404]
prologues:
- path: /{index}
method: PUT
parameters:
index: games
chapters:
- synopsis: Create an alias.
path: /{index}/_aliases/{name}
method: PUT
parameters:
index: games
name: jeux
- synopsis: Get an alias from index.
method: GET
path: /{index}/_alias/{name}
parameters:
index: games
name: jeux
response:
status: 200
content_type: application/json
payload:
games:
aliases:
jeux: {}
- synopsis: Get an alias from _aliases.
method: GET
path: /_alias/{name}
parameters:
name: jeux
response:
status: 200
content_type: application/json
payload:
games:
aliases:
jeux: {}
- synopsis: Multiple alias operations.
path: /_aliases
method: POST
request_body:
payload:
actions:
- remove:
index: games
alias: jeux
- add:
index: games
alias: juegos1

Check failure on line 56 in tests/_core/aliases.yaml

View workflow job for this annotation

GitHub Actions / test

Unknown word: "juegos"
- add:
index: games
alias: juegos2

Check failure on line 59 in tests/_core/aliases.yaml

View workflow job for this annotation

GitHub Actions / test

Unknown word: "juegos"
response:
status: 200
payload:
acknowledged: true
- synopsis: Delete an alias from _aliases.
path: /{index}/_aliases/{name}
method: DELETE
parameters:
index: games
name: juegos1

Check failure on line 69 in tests/_core/aliases.yaml

View workflow job for this annotation

GitHub Actions / test

Unknown word: "juegos"
- synopsis: Delete an alias from _alias.
path: /{index}/_alias/{name}
method: DELETE
parameters:
index: games
name: juegos2

Check failure on line 75 in tests/_core/aliases.yaml

View workflow job for this annotation

GitHub Actions / test

Unknown word: "juegos"


18 changes: 17 additions & 1 deletion tests/cat/aliases.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
$schema: ../../json_schemas/test_story.schema.yaml

description: Test cat/aliases endpoints.
epilogues:
- path: /games
method: DELETE
status: [200, 404]
prologues:
- path: /{index}
method: PUT
parameters:
index: games
- path: /{index}/_aliases/{name}
method: PUT
parameters:
index: games
name: jeux
chapters:
- synopsis: Cat with a text response.
path: /_cat/aliases
Expand All @@ -16,4 +30,6 @@ chapters:
response:
status: 200
content_type: application/json
payload: []
payload:
- alias: jeux
index: games
11 changes: 11 additions & 0 deletions tests/cat/allocation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$schema: ../../json_schemas/test_story.schema.yaml

description: Test cat/allocation endpoints.
chapters:
- synopsis: Cat with a json response.
path: /_cat/allocation
method: GET
parameters:
format: json
response:
status: 200
11 changes: 11 additions & 0 deletions tests/cat/cluster_manager.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$schema: ../../json_schemas/test_story.schema.yaml

description: Test cat/cluster_manager endpoints.
chapters:
- synopsis: Cat with a json response.
path: /_cat/cluster_manager
method: GET
parameters:
format: json
response:
status: 200
11 changes: 11 additions & 0 deletions tests/cat/count.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$schema: ../../json_schemas/test_story.schema.yaml

description: Test cat/count endpoints.
chapters:
- synopsis: Cat with a json response.
path: /_cat/count
method: GET
parameters:
format: json
response:
status: 200
11 changes: 11 additions & 0 deletions tests/cat/fielddata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$schema: ../../json_schemas/test_story.schema.yaml

description: Test cat/fielddata endpoints.
chapters:
- synopsis: Cat with a json response.
path: /_cat/fielddata
method: GET
parameters:
format: json
response:
status: 200
Loading

0 comments on commit 0edb266

Please sign in to comment.