Skip to content

Commit

Permalink
Add tests for SplitResponseProcessor
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Widdis <[email protected]>
  • Loading branch information
dbwiddis committed Aug 23, 2024
1 parent 5416507 commit 5fa780c
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,15 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added API spec for security plugin ([#271](https://github.com/opensearch-project/opensearch-api-specification/pull/271))
- Added `/_plugins/_security/api/certificates/` ([#439](https://github.com/opensearch-project/opensearch-api-specification/pull/439))
- Added `/_plugins/_ml/models/{model_id}/_deploy`, `_undeploy` and `knn_vector` type in `passage_embedding` ([#504](https://github.com/opensearch-project/opensearch-api-specification/pull/504))
- Added `PersonalizeSearchRanking`, `RetrievalAugmentedGeneration`, `Rerank`, `Collapse`, `TruncateHits` and `SplitResponseProcessor` ([#505](https://github.com/opensearch-project/opensearch-api-specification/pull/505))
- Added `PersonalizeSearchRanking`, `RetrievalAugmentedGeneration`, `Rerank`, `Collapse`, `TruncateHits`, `SortResponseProcessor` and `SplitResponseProcessor` ([#505](https://github.com/opensearch-project/opensearch-api-specification/pull/505))
- Added `/_plugins/_security/api/certificates/` to API spec ([#439](https://github.com/opensearch-project/opensearch-api-specification/pull/439))
- Added support for annotating and testing the API spec against multiple OpenSearch distributions ([#483](https://github.com/opensearch-project/opensearch-api-specification/pull/483))
- Added `read_time`, `write_time`, `queue_size` and `io_time_in_millis` to `IoStatDevice` ([#483](https://github.com/opensearch-project/opensearch-api-specification/pull/483))
- Added `total_rejections_breakup` to `ShardIndexingPressureStats` ([#483](https://github.com/opensearch-project/opensearch-api-specification/pull/483))
- Added `cancelled_task_percentage` and `current_cancellation_eligible_tasks_count` to `ShardSearchBackpressureTaskCancellationStats` ([#483](https://github.com/opensearch-project/opensearch-api-specification/pull/483))
- Added detailed test coverage report ([#513](https://github.com/opensearch-project/opensearch-api-specification/pull/513))
- Added 404 responses to `/_alias/{name}` and `/{index}/_alias/{name}` ([#519](https://github.com/opensearch-project/opensearch-api-specification/pull/519))
- Added tests for `SplitResponseProcessor` ([#526](https://github.com/opensearch-project/opensearch-api-specification/pull/526))

### Changed

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$schema: ../../../../../../json_schemas/test_story.schema.yaml

description: |-
Test the creation of a search pipeline with a response processor.
Test the creation of a search pipeline with a filter_query request processor.
version: '>= 2.8'
prologues:
- path: /_bulk
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
$schema: ../../../../../../json_schemas/test_story.schema.yaml

description: |-
Test the creation of a search pipeline with split and sort response processors.
version: '>= 2.17'
prologues:
- path: /numbers/_doc/1
method: POST
parameters:
refresh: true
request:
payload:
number_string:
- 'zero,one,two,three'
status: [201]
epilogues:
- path: /_search/pipeline/numberss_pipeline

Check failure on line 17 in tests/default/_core/search/pipeline/response_processor/split_and_sort.yaml

View workflow job for this annotation

GitHub Actions / lint

Unknown word: "numberss"
method: DELETE
status: [200, 404]
- path: /numbers
method: DELETE
status: [200, 404]
chapters:
- synopsis: Create search pipeline.
path: /_search/pipeline/{id}
method: PUT
parameters:
id: numbers_pipeline
request:
payload:
response_processors:
- split:
field: number_string
separator: ','
target_field: number_strings
- sort:
field: number_strings
order: asc
target_field: sorted_number_strings
response:
status: 200
payload:
acknowledged: true
- synopsis: Query created pipeline.
path: /_search/pipeline/{id}
method: GET
parameters:
id: numbers_pipeline
response:
status: 200
- synopsis: Search.
warnings:
multiple-paths-detected: false
path: /{index}/_search
method: GET
parameters:
index: numbers
search_pipeline: nnumbers_pipeline

Check failure on line 58 in tests/default/_core/search/pipeline/response_processor/split_and_sort.yaml

View workflow job for this annotation

GitHub Actions / lint

Unknown word: "nnumbers"
response:
status: 200
payload:
hits:
total:
value: 1
hits:
- _index: numbers
_source:
number_string:
- 'zero,one,two,three'
number_strings:
- zero
- one

Check failure on line 72 in tests/default/_core/search/pipeline/response_processor/split_and_sort.yaml

View workflow job for this annotation

GitHub Actions / lint

Expected sequence values to be in ascending order. 'one' should be before 'zero'
- two
- three

Check failure on line 74 in tests/default/_core/search/pipeline/response_processor/split_and_sort.yaml

View workflow job for this annotation

GitHub Actions / lint

Expected sequence values to be in ascending order. 'three' should be before 'two'
sorted_number_strings:
- one
- three
- two
- zero

0 comments on commit 5fa780c

Please sign in to comment.