Skip to content

Commit

Permalink
Fixed POST and DELETE /_dangling/{index_uuid} returning 202.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <dblock@amazon.com>
  • Loading branch information
dblock committed Nov 21, 2024
1 parent 1245233 commit 41d225f
Show file tree
Hide file tree
Showing 18 changed files with 51 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixed `/{index}/_create/{id}` returning `201` ([#669](https://github.com/opensearch-project/opensearch-api-specification/pull/669))
- Fixed `ml._common.yaml#SearchModelsResponse` and `SearchModelsHitsHit` ([#672](https://github.com/opensearch-project/opensearch-api-specification/pull/672))
- Fixed `refresh` options to allow `boolean` and `string` ([#673](https://github.com/opensearch-project/opensearch-api-specification/pull/673))
- Fixed `POST` and `DELETE /_dangling/{index_uuid}` returning `202` ([#686](https://github.com/opensearch-project/opensearch-api-specification/pull/686))

### Changed
- Changed `tasks._common:TaskInfo` and `tasks._common:TaskGroup` to be composed of a `tasks._common:TaskInfoBase` ([#683](https://github.com/opensearch-project/opensearch-api-specification/pull/683))
Expand Down
12 changes: 6 additions & 6 deletions spec/namespaces/dangling_indices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ paths:
- $ref: '#/components/parameters/dangling_indices.import_dangling_index::query.master_timeout'
- $ref: '#/components/parameters/dangling_indices.import_dangling_index::query.timeout'
responses:
'200':
$ref: '#/components/responses/dangling_indices.import_dangling_index@200'
'202':
$ref: '#/components/responses/dangling_indices.import_dangling_index@202'
delete:
operationId: dangling_indices.delete_dangling_index.0
x-operation-group: dangling_indices.delete_dangling_index
Expand All @@ -47,17 +47,17 @@ paths:
- $ref: '#/components/parameters/dangling_indices.delete_dangling_index::query.master_timeout'
- $ref: '#/components/parameters/dangling_indices.delete_dangling_index::query.timeout'
responses:
'200':
$ref: '#/components/responses/dangling_indices.delete_dangling_index@200'
'202':
$ref: '#/components/responses/dangling_indices.delete_dangling_index@202'
components:
requestBodies: {}
responses:
dangling_indices.delete_dangling_index@200:
dangling_indices.delete_dangling_index@202:
content:
application/json:
schema:
$ref: '../schemas/_common.yaml#/components/schemas/AcknowledgedResponseBase'
dangling_indices.import_dangling_index@200:
dangling_indices.import_dangling_index@202:
content:
application/json:
schema:
Expand Down
6 changes: 6 additions & 0 deletions tests/dangling/.data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,10 @@ curl -X POST http://localhost:9200/_cluster/voting_config_exclusions?node_names=

Stop the cluster.

Remove lock files, those will cause an "Underlying file changed by an external force" error when copied to the docker container.

```
find . -name *.lock | xargs rm
```

Now you can run the [single-node docker-compose](../docker-compose.yml) in the folder above.
6 changes: 3 additions & 3 deletions tests/dangling/.data/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ services:
- opensearch-net

volumes:
opensearch-data1:
opensearch-data2:
opensearch-data1: {}
opensearch-data2: {}

networks:
opensearch-net:
opensearch-net: {}
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
7 changes: 7 additions & 0 deletions tests/dangling/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ARG OPENSEARCH_DOCKER_HUB_PROJECT
ARG OPENSEARCH_VERSION
ARG OPENSEARCH_DOCKER_REF

FROM ${OPENSEARCH_DOCKER_HUB_PROJECT}/opensearch:${OPENSEARCH_VERSION}${OPENSEARCH_DOCKER_REF}

COPY --chown=1000:1000 .data/opensearch-data1 /usr/share/opensearch/data
15 changes: 10 additions & 5 deletions tests/dangling/core/dangling.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ chapters:
path: /_dangling/{index_uuid}
method: POST
parameters:
index_uuid: p6tliBznQO-FzTdslShrwA
index_uuid: p6tliBznQO-FzTdslShrwA # movies
accept_data_loss: true
response:
status: 200
payload:
dangling_indices:
- index_name: movies
status: 202
- synopsis: Delete a dangling index.
path: /_dangling/{index_uuid}
method: DELETE
parameters:
index_uuid: _bJfm1BsRdG-N91LRxI1Vg # .opensearch-observability
accept_data_loss: true
response:
status: 202
18 changes: 18 additions & 0 deletions tests/dangling/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: '3'

services:
opensearch-cluster:
build:
context: .
args:
- OPENSEARCH_DOCKER_HUB_PROJECT=${OPENSEARCH_DOCKER_HUB_PROJECT:-opensearchproject}
- OPENSEARCH_DOCKER_REF=${OPENSEARCH_DOCKER_REF}
- OPENSEARCH_VERSION=${OPENSEARCH_VERSION:-latest}
ports:
- 9200:9200
- 9600:9600
environment:
- DISABLE_INSTALL_DEMO_CONFIG=true
- DISABLE_SECURITY_PLUGIN=true
- OPENSEARCH_JAVA_OPTS=${OPENSEARCH_JAVA_OPTS}
- discovery.type=single-node

0 comments on commit 41d225f

Please sign in to comment.