Skip to content

Commit

Permalink
Add test for icu_collation_keyword
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <tsfarr@amazon.com>
  • Loading branch information
Xtansia committed Nov 13, 2024
1 parent 1a248a4 commit 39555ce
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/test-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jobs:
tests: plugins/query_insights
- version: 2.18.0
tests: plugins/workload-management
- version: 2.18.0
tests: plugins/analysis-icu
- version: 2.19.0
hub: opensearchstaging
ref: '@sha256:4da23e0137b2b67206d23b36fcf0914cc39b3bf19310c782f536e4934b86f6cc'
Expand Down
8 changes: 7 additions & 1 deletion spec/schemas/_common.mapping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ components:
type: object
discriminator:
propertyName: type
x-default: 'object'
x-default: object
oneOf:
- $ref: '#/components/schemas/BinaryProperty'
- $ref: '#/components/schemas/BooleanProperty'
Expand Down Expand Up @@ -1090,6 +1090,12 @@ components:
$ref: '_common.analysis.yaml#/components/schemas/IcuCollationStrength'
variable_top:
type: string
country:
type: string
language:
type: string
variant:
type: string
required:
- type
MatchType:
Expand Down
6 changes: 6 additions & 0 deletions tests/plugins/analysis-icu/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ARG OPENSEARCH_DOCKER_HUB_PROJECT
ARG OPENSEARCH_VERSION
ARG OPENSEARCH_DOCKER_REF

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

Check failure on line 5 in tests/plugins/analysis-icu/Dockerfile

View workflow job for this annotation

GitHub Actions / check

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'OpenSearch' instead of 'opensearch'. Raw Output: {"message": "[Vale.Terms] Use 'OpenSearch' instead of 'opensearch'.", "location": {"path": "tests/plugins/analysis-icu/Dockerfile", "range": {"start": {"line": 5, "column": 39}}}, "severity": "ERROR"}
RUN ./bin/opensearch-plugin install -b analysis-icu

Check failure on line 6 in tests/plugins/analysis-icu/Dockerfile

View workflow job for this annotation

GitHub Actions / check

[vale] reported by reviewdog 🐶 [Vale.Terms] Use 'OpenSearch' instead of 'opensearch'. Raw Output: {"message": "[Vale.Terms] Use 'OpenSearch' instead of 'opensearch'.", "location": {"path": "tests/plugins/analysis-icu/Dockerfile", "range": {"start": {"line": 6, "column": 11}}}, "severity": "ERROR"}
17 changes: 17 additions & 0 deletions tests/plugins/analysis-icu/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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:
- OPENSEARCH_INITIAL_ADMIN_PASSWORD=${OPENSEARCH_PASSWORD:-myStrongPassword123!}
- OPENSEARCH_JAVA_OPTS=${OPENSEARCH_JAVA_OPTS}
- discovery.type=single-node
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
$schema: ../../../../../json_schemas/test_story.schema.yaml

description: Test mappings endpoints.
warnings:
multiple-paths-detected: false
prologues: []
epilogues:
- path: /collated
method: DELETE
status: [200, 404]
chapters:
- synopsis: Create an index with a mapping that uses ICU collation.
path: /{index}
method: PUT
parameters:
index: collated
request:
payload:
mappings:
properties:
phrase:
type: icu_collation_keyword
language: tr
strength: primary

- synopsis: Get mappings for index.
path: /{index}/_mapping
method: GET
parameters:
index: collated
response:
status: 200
payload:
collated:
mappings:
properties:
phrase:
type: icu_collation_keyword
language: tr
strength: primary

- synopsis: Index values with ICU collation.
path: /{index}/_bulk
method: POST
parameters:
index: collated
refresh: wait_for
request:
content_type: application/x-ndjson
payload:
- { create: { _id: '1' } }

Check failure on line 51 in tests/plugins/analysis-icu/indices/mapping/icu_collation_keyword.yaml

View workflow job for this annotation

GitHub Actions / lint

There should be no space after '{'

Check failure on line 51 in tests/plugins/analysis-icu/indices/mapping/icu_collation_keyword.yaml

View workflow job for this annotation

GitHub Actions / lint

There should be no space after '{'

Check failure on line 51 in tests/plugins/analysis-icu/indices/mapping/icu_collation_keyword.yaml

View workflow job for this annotation

GitHub Actions / lint

There should be no space before '}'

Check failure on line 51 in tests/plugins/analysis-icu/indices/mapping/icu_collation_keyword.yaml

View workflow job for this annotation

GitHub Actions / lint

There should be no space before '}'
- { phrase: 'I WİLL USE TURKİSH CASING' }

Check failure on line 52 in tests/plugins/analysis-icu/indices/mapping/icu_collation_keyword.yaml

View workflow job for this annotation

GitHub Actions / lint

There should be no space after '{'

Check failure on line 52 in tests/plugins/analysis-icu/indices/mapping/icu_collation_keyword.yaml

View workflow job for this annotation

GitHub Actions / lint

Must use plain style scalar

Check failure on line 52 in tests/plugins/analysis-icu/indices/mapping/icu_collation_keyword.yaml

View workflow job for this annotation

GitHub Actions / lint

Unknown word: "WİLL"

Check failure on line 52 in tests/plugins/analysis-icu/indices/mapping/icu_collation_keyword.yaml

View workflow job for this annotation

GitHub Actions / lint

Unknown word: "TURKİSH"

Check failure on line 52 in tests/plugins/analysis-icu/indices/mapping/icu_collation_keyword.yaml

View workflow job for this annotation

GitHub Actions / lint

There should be no space before '}'
- { create: { _id: '2' } }

Check failure on line 53 in tests/plugins/analysis-icu/indices/mapping/icu_collation_keyword.yaml

View workflow job for this annotation

GitHub Actions / lint

There should be no space after '{'
- { phrase: 'ı will use turkish casıng' }

- synopsis: Search for values with ICU collation.
path: /{index}/_search
method: POST
parameters:
index: collated
request:
payload:
query:
term:
phrase: 'I WİLL USE TURKİSH CASING'
sort:
- phrase
- { _id: desc }
response:
status: 200
payload:
hits:
total:
value: 2
hits:
- _id: '2'
_source:
phrase: 'ı will use turkish casıng'
- _id: '1'
_source:
phrase: 'I WİLL USE TURKİSH CASING'

0 comments on commit 39555ce

Please sign in to comment.