diff --git a/tests/default/_core/list.yaml b/tests/default/_core/list.yaml new file mode 100644 index 000000000..c6573222c --- /dev/null +++ b/tests/default/_core/list.yaml @@ -0,0 +1,12 @@ +$schema: ../../../json_schemas/test_story.schema.yaml + +description: Test _list operations. +# TODO: Re-enable in 3.0, see https://github.com/opensearch-project/opensearch-api-specification/pull/613 +version: '>= 2.18 < 3.0' +chapters: + - synopsis: Returns available list APIs. + path: /_list + method: GET + response: + status: 200 + content_type: text/plain diff --git a/tests/default/_core/mapping/field.yaml b/tests/default/_core/mapping/field.yaml new file mode 100644 index 000000000..04c47f370 --- /dev/null +++ b/tests/default/_core/mapping/field.yaml @@ -0,0 +1,28 @@ +$schema: ../../../../json_schemas/test_story.schema.yaml + +description: Test field mappings. +prologues: + - path: /{index} + method: PUT + parameters: + index: movies + request: + payload: + mappings: + properties: + director: + type: text + year: + type: integer +epilogues: + - path: /movies + method: DELETE + status: [200, 404] +chapters: + - synopsis: Get field mappings across multiple indexes. + path: /_mapping/field/{fields} + method: GET + parameters: + fields: year + response: + status: 200 diff --git a/tests/default/_core/mget.yaml b/tests/default/_core/mget.yaml index 42f1afcf7..0d409ecf6 100644 --- a/tests/default/_core/mget.yaml +++ b/tests/default/_core/mget.yaml @@ -23,7 +23,7 @@ prologues: - {create: {_index: movies, _id: movie2}} - {director: Nicolas Winding Refn, title: Drive, year: 1960} chapters: - - synopsis: Retrieve documents from multiple indexes. + - synopsis: Retrieve documents from multiple indexes (GET). path: /_mget method: GET request: @@ -45,3 +45,21 @@ chapters: _id: movie1 - _index: books _id: book1 + - synopsis: Retrieve documents from multiple indexes (POST). + path: /_mget + method: POST + request: + payload: + docs: + - _index: books + _id: book1 + - _index: movies + _id: movie1 + response: + status: 200 + payload: + docs: + - _index: books + _id: book1 + - _index: movies + _id: movie1 diff --git a/tests/default/flow_framework/deprovision.yaml b/tests/default/flow_framework/deprovision.yaml index dada6f1f2..83ac14cba 100644 --- a/tests/default/flow_framework/deprovision.yaml +++ b/tests/default/flow_framework/deprovision.yaml @@ -3,7 +3,7 @@ description: Test flow_framework provision endpoints. version: '>= 2.12' prologues: - path: /_plugins/_flow_framework/workflow - id: create_flow_framework + id: workflow method: POST parameters: use_case: semantic_search_with_cohere_embedding_query_enricher @@ -12,24 +12,24 @@ prologues: payload: create_connector.credential.key: test_api_key output: - test_workflow_id: payload.workflow_id + workflow_id: payload.workflow_id epilogues: - path: /_plugins/_flow_framework/workflow/{workflow_id}/_deprovision method: POST status: [200, 404] parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} - path: /_plugins/_flow_framework/workflow/{workflow_id} method: DELETE status: [200, 404] parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} chapters: - synopsis: Deprovision workflow. path: /_plugins/_flow_framework/workflow/{workflow_id}/_deprovision method: POST parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} response: status: 200 - synopsis: Deprovision workflow using an invalid ID. diff --git a/tests/default/flow_framework/provision.yaml b/tests/default/flow_framework/provision.yaml index fb1e41a0d..37da72073 100644 --- a/tests/default/flow_framework/provision.yaml +++ b/tests/default/flow_framework/provision.yaml @@ -3,7 +3,7 @@ description: Test flow_framework provision endpoints. version: '>= 2.12' prologues: - path: /_plugins/_flow_framework/workflow - id: create_flow_framework + id: workflow method: POST parameters: use_case: semantic_search_with_cohere_embedding_query_enricher @@ -11,23 +11,23 @@ prologues: payload: create_connector.credential.key: test_api_key output: - test_workflow_id: payload.workflow_id + workflow_id: payload.workflow_id epilogues: - path: /_plugins/_flow_framework/workflow/{workflow_id}/_deprovision method: POST parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} - path: /_plugins/_flow_framework/workflow/{workflow_id} method: DELETE status: [200, 404] parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} chapters: - synopsis: Provision workflow. path: /_plugins/_flow_framework/workflow/{workflow_id}/_provision method: POST parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} request: payload: openai_key: '1234556' diff --git a/tests/default/flow_framework/search.yaml b/tests/default/flow_framework/search.yaml index 3e3353079..d6c2e556d 100644 --- a/tests/default/flow_framework/search.yaml +++ b/tests/default/flow_framework/search.yaml @@ -3,7 +3,7 @@ description: Test flow_framework provision endpoints. version: '>= 2.12' prologues: - path: /_plugins/_flow_framework/workflow - id: create_flow_framework + id: workflow method: POST parameters: use_case: semantic_search_with_cohere_embedding_query_enricher @@ -11,13 +11,13 @@ prologues: payload: create_connector.credential.key: test_api_key output: - test_workflow_id: payload.workflow_id + workflow_id: payload.workflow_id epilogues: - path: /_plugins/_flow_framework/workflow/{workflow_id} method: DELETE status: [200, 404] parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} chapters: - synopsis: Search workflow match the name. path: /_plugins/_flow_framework/workflow/_search diff --git a/tests/default/flow_framework/search_state.yaml b/tests/default/flow_framework/search_state.yaml index 7dc59ba04..130998e0b 100644 --- a/tests/default/flow_framework/search_state.yaml +++ b/tests/default/flow_framework/search_state.yaml @@ -3,7 +3,7 @@ description: Test flow_framework provision endpoints. version: '>= 2.12' prologues: - path: /_plugins/_flow_framework/workflow - id: create_flow_framework + id: workflow method: POST parameters: use_case: semantic_search_with_cohere_embedding_query_enricher @@ -11,13 +11,13 @@ prologues: payload: create_connector.credential.key: test_api_key output: - test_workflow_id: payload.workflow_id + workflow_id: payload.workflow_id epilogues: - path: /_plugins/_flow_framework/workflow/{workflow_id} method: DELETE status: [200, 404] parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} chapters: - synopsis: Search workflow state. path: /_plugins/_flow_framework/workflow/state/_search diff --git a/tests/default/flow_framework/status.yaml b/tests/default/flow_framework/status.yaml index fd9ea2300..7f07f4d9c 100644 --- a/tests/default/flow_framework/status.yaml +++ b/tests/default/flow_framework/status.yaml @@ -3,7 +3,7 @@ description: Test flow_framework provision endpoints. version: '>= 2.12' prologues: - path: /_plugins/_flow_framework/workflow - id: create_flow_framework + id: workflow method: POST parameters: use_case: semantic_search_with_cohere_embedding_query_enricher @@ -11,19 +11,19 @@ prologues: payload: create_connector.credential.key: test_api_key output: - test_workflow_id: payload.workflow_id + workflow_id: payload.workflow_id epilogues: - path: /_plugins/_flow_framework/workflow/{workflow_id} method: DELETE status: [200, 404] parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} chapters: - synopsis: Get workflow status. path: /_plugins/_flow_framework/workflow/{workflow_id}/_status method: GET parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} response: status: 200 payload: diff --git a/tests/default/flow_framework/steps.yaml b/tests/default/flow_framework/steps.yaml index 9e4bc1704..24ef624c9 100644 --- a/tests/default/flow_framework/steps.yaml +++ b/tests/default/flow_framework/steps.yaml @@ -3,7 +3,7 @@ description: Test flow_framework provision endpoints. version: '>= 2.12' prologues: - path: /_plugins/_flow_framework/workflow - id: create_flow_framework + id: workflow method: POST parameters: use_case: semantic_search_with_cohere_embedding_query_enricher @@ -11,20 +11,20 @@ prologues: payload: create_connector.credential.key: test_api_key output: - test_workflow_id: payload.workflow_id + workflow_id: payload.workflow_id epilogues: - path: /_plugins/_flow_framework/workflow/{workflow_id} method: DELETE status: [200, 404] parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} chapters: - synopsis: Get workflow steps. path: /_plugins/_flow_framework/workflow/_steps method: GET response: status: 200 - - synopsis: Get workflow steps with invalid query parameter. + - synopsis: Get workflow steps with an invalid query parameter. path: /_plugins/_flow_framework/workflow/_steps method: GET parameters: diff --git a/tests/default/flow_framework/template.yaml b/tests/default/flow_framework/template.yaml index 84ecd8638..45334166b 100644 --- a/tests/default/flow_framework/template.yaml +++ b/tests/default/flow_framework/template.yaml @@ -1,23 +1,23 @@ $schema: ../../../json_schemas/test_story.schema.yaml -description: Test flow_framework endpoints using sample template. +description: Test flow_framework endpoints using a sample template. version: '>= 2.12' epilogues: - path: /_plugins/_flow_framework/workflow/{workflow_id} method: DELETE status: [200, 404] parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} warnings: multiple-paths-detected: false chapters: - synopsis: Create workflow with openAI model. - id: create_flow_framework + id: workflow path: /_plugins/_flow_framework/workflow method: POST request: payload: name: Deploy OpenAI Model - description: Deploy a model using a connector to OpenAI + description: Deploy a model using a connector to OpenAI. use_case: PROVISION version: template: 1.0.0 @@ -31,7 +31,7 @@ chapters: type: create_connector user_inputs: name: OpenAI Chat Connector - description: The connector to public OpenAI model service for GPT 3.5 + description: The connector to public OpenAI model service for GPT 3.5. version: '1' protocol: http parameters: @@ -57,12 +57,12 @@ chapters: response: status: 201 output: - test_workflow_id: payload.workflow_id + workflow_id: payload.workflow_id - synopsis: Update workflow. path: /_plugins/_flow_framework/workflow/{workflow_id} method: PUT parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} update_fields: true request: payload: @@ -73,7 +73,7 @@ chapters: path: /_plugins/_flow_framework/workflow/{workflow_id} method: PUT parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} update_fields: true request: payload: @@ -85,11 +85,11 @@ chapters: path: /_plugins/_flow_framework/workflow/{workflow_id} method: PUT parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} request: payload: name: Deploy OpenAI Model - description: Deploy a model using a connector to OpenAI + description: Deploy a model using a connector to OpenAI. use_case: PROVISION version: template: 1.0.0 @@ -103,7 +103,7 @@ chapters: type: create_connector user_inputs: name: OpenAI Chat Connector - description: The connector to public OpenAI model service for GPT 3.5 update + description: The connector to public OpenAI model service for GPT 3.5 update. version: '1' protocol: http parameters: @@ -132,14 +132,14 @@ chapters: path: /_plugins/_flow_framework/workflow/{workflow_id}/_provision method: POST parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} response: status: 200 - - synopsis: Update workflow fail With provision and update_fields set true. + - synopsis: Update workflow fail with `provision` and `update_fields` set to `true`. path: /_plugins/_flow_framework/workflow/{workflow_id} method: PUT parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} provision: true update_fields: true request: @@ -147,12 +147,12 @@ chapters: name: test_create_work_flow response: status: 400 - - synopsis: Update workflow fail With Reprovision and updateFields set true. + - synopsis: Update workflow fail with `reprovision` and `update_fields` set to `true`. version: '>= 2.17' path: /_plugins/_flow_framework/workflow/{workflow_id} method: PUT parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} reprovision: true update_fields: true request: @@ -160,7 +160,7 @@ chapters: name: test_create_work_flow response: status: 400 - - synopsis: Create workflow fail With Reprovision set true. + - synopsis: Create workflow fail with `reprovision` set to `true`. version: '>= 2.17' path: /_plugins/_flow_framework/workflow method: POST @@ -171,7 +171,7 @@ chapters: name: test_create_work_flow response: status: 400 - - synopsis: Create workflow fail With Reprovision set true and UseCase Not null. + - synopsis: Create workflow fail with `reprovision` set to `true` and `use_case` not `null`. version: '>= 2.17' path: /_plugins/_flow_framework/workflow method: POST @@ -183,12 +183,12 @@ chapters: name: test_create_work_flow response: status: 400 - - synopsis: Update workflow fail With Reprovision set true and UseCase Not null. + - synopsis: Update workflow fail with `reprovision` set to `true` and `use_case` not `null`. version: '>= 2.17' path: /_plugins/_flow_framework/workflow/{workflow_id} method: PUT parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} reprovision: true use_case: test_use_case request: @@ -200,7 +200,7 @@ chapters: path: /_plugins/_flow_framework/workflow/{workflow_id} method: GET parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} response: status: 200 - synopsis: Get workflow fail. @@ -234,6 +234,6 @@ chapters: path: /_plugins/_flow_framework/workflow/{workflow_id} method: DELETE parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} response: status: 200 \ No newline at end of file diff --git a/tests/default/flow_framework/workflow.yaml b/tests/default/flow_framework/workflow.yaml index 4f50a012d..039550820 100644 --- a/tests/default/flow_framework/workflow.yaml +++ b/tests/default/flow_framework/workflow.yaml @@ -6,20 +6,20 @@ epilogues: method: DELETE status: [200, 404] parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} chapters: - synopsis: Create workflow. - id: create_flow_framework + id: workflow path: /_plugins/_flow_framework/workflow method: POST request: payload: - name: test_create_work_flow + name: Test Workflow response: status: 201 output: - test_workflow_id: payload.workflow_id - - synopsis: Create workflow With Provision and updateFields set true. + workflow_id: payload.workflow_id + - synopsis: Create workflow with `provision` and `update_fields` set to `true`. path: /_plugins/_flow_framework/workflow method: POST parameters: @@ -27,35 +27,35 @@ chapters: update_fields: true request: payload: - name: test_create_work_flow + name: Test Workflow response: status: 400 - - synopsis: Update workflow With provision and update_fields set. + - synopsis: Update workflow with `provision` and `update_fields` set to `true`. path: /_plugins/_flow_framework/workflow/{workflow_id} method: PUT parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} provision: true update_fields: true request: payload: - name: test_create_work_flow + name: Test Workflow response: status: 400 - - synopsis: Update workflow With Reprovision and updateFields set true. + - synopsis: Update workflow with `reprovision` and `update_fields` set to `true`. version: '>= 2.17' path: /_plugins/_flow_framework/workflow/{workflow_id} method: PUT parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} reprovision: true update_fields: true request: payload: - name: test_create_work_flow + name: Test Workflow response: status: 400 - - synopsis: Create workflow With Reprovision set true. + - synopsis: Create workflow with `reprovision` set to `true`. version: '>= 2.17' path: /_plugins/_flow_framework/workflow method: POST @@ -63,10 +63,10 @@ chapters: reprovision: true request: payload: - name: test_create_work_flow + name: Test Workflow response: status: 400 - - synopsis: Create workflow With Reprovision set true and UseCase Not null. + - synopsis: Create workflow with `reprovision` set to `true` and a value for `use_case`. version: '>= 2.17' path: /_plugins/_flow_framework/workflow method: POST @@ -75,34 +75,34 @@ chapters: use_case: test_use_case request: payload: - name: test_create_work_flow + name: Test Workflow response: status: 400 - - synopsis: Update workflow With Reprovision set true and UseCase Not null. + - synopsis: Update workflow with `reprovision` set to `true` and a value for `use_case`. version: '>= 2.17' path: /_plugins/_flow_framework/workflow/{workflow_id} method: PUT parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} reprovision: true use_case: test_use_case request: payload: - name: test_create_work_flow + name: Test Workflow response: status: 400 - synopsis: Get workflow. path: /_plugins/_flow_framework/workflow/{workflow_id} method: GET parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} response: status: 200 - synopsis: Update workflow. path: /_plugins/_flow_framework/workflow/{workflow_id} method: PUT parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} request: payload: name: test_update_work_flow @@ -122,7 +122,7 @@ chapters: path: /_plugins/_flow_framework/workflow/{workflow_id} method: DELETE parameters: - workflow_id: ${create_flow_framework.test_workflow_id} + workflow_id: ${workflow.workflow_id} response: status: 200 - synopsis: Delete workflow using an invalid ID. diff --git a/tests/default/flow_framework/workflow/search.yaml b/tests/default/flow_framework/workflow/search.yaml new file mode 100644 index 000000000..0b3816364 --- /dev/null +++ b/tests/default/flow_framework/workflow/search.yaml @@ -0,0 +1,36 @@ +$schema: ../../../../json_schemas/test_story.schema.yaml +description: Test flow_framework workflow search endpoints. +version: '>= 2.12' +epilogues: + - path: /_plugins/_flow_framework/workflow/{workflow_id} + method: DELETE + status: [200, 404] + parameters: + workflow_id: ${workflow.workflow_id} +prologues: + - id: workflow + path: /_plugins/_flow_framework/workflow + method: POST + request: + payload: + name: Test Workflow + status: [201] + output: + workflow_id: payload.workflow_id +chapters: + - synopsis: Search for a workflow. + path: /_plugins/_flow_framework/workflow/_search + method: GET + request: + payload: + query: + match_all: {} + response: + status: 200 + payload: + hits: + hits: + - _index: .plugins-flow-framework-templates + _source: + name: Test Workflow + diff --git a/tests/default/flow_framework/workflow/state/search.yaml b/tests/default/flow_framework/workflow/state/search.yaml new file mode 100644 index 000000000..67138eb1e --- /dev/null +++ b/tests/default/flow_framework/workflow/state/search.yaml @@ -0,0 +1,36 @@ +$schema: ../../../../../json_schemas/test_story.schema.yaml +description: Test flow_framework workflow search state endpoints. +version: '>= 2.12' +epilogues: + - path: /_plugins/_flow_framework/workflow/{workflow_id} + method: DELETE + status: [200, 404] + parameters: + workflow_id: ${workflow.workflow_id} +prologues: + - id: workflow + path: /_plugins/_flow_framework/workflow + method: POST + request: + payload: + name: Test Workflow + status: [201] + output: + workflow_id: payload.workflow_id +chapters: + - synopsis: Search for a workflow. + path: /_plugins/_flow_framework/workflow/state/_search + method: GET + request: + payload: + query: + match_all: {} + response: + status: 200 + payload: + hits: + hits: + - _index: .plugins-flow-framework-state + _source: + state: NOT_STARTED + diff --git a/tests/default/indices/mapping/field.yaml b/tests/default/indices/mapping/field.yaml index 5037e2ec3..88a2ff8f4 100644 --- a/tests/default/indices/mapping/field.yaml +++ b/tests/default/indices/mapping/field.yaml @@ -2,10 +2,8 @@ $schema: ../../../../json_schemas/test_story.schema.yaml description: Test specific field mappings endpoints. prologues: - - path: /{index} + - path: movies method: PUT - parameters: - index: movies request: payload: mappings: @@ -14,30 +12,11 @@ prologues: type: text year: type: integer - location: - type: ip - ignore_malformed: true epilogues: - path: /movies method: DELETE status: [200, 404] chapters: - - synopsis: Add new fields to index mapping. - path: /{index}/_mapping - method: POST - parameters: - index: movies - request: - payload: - properties: - genre: - type: text - rating: - type: float - response: - status: 200 - payload: - acknowledged: true - synopsis: Get specific field mappings for an index. path: /{index}/_mapping/field/{fields} method: GET diff --git a/tests/default/indices/mapping/index.yaml b/tests/default/indices/mapping/index.yaml index 35a74eeea..4a1fe86de 100644 --- a/tests/default/indices/mapping/index.yaml +++ b/tests/default/indices/mapping/index.yaml @@ -94,7 +94,7 @@ chapters: status: 200 payload: acknowledged: true - - synopsis: Update mapping for an index with setting dynamic to false. + - synopsis: Update mapping for an index with setting `dynamic` to `false`. path: /{index}/_mapping method: PUT parameters: @@ -111,7 +111,7 @@ chapters: status: 200 payload: acknowledged: true - - synopsis: Update mapping for an index with setting dynamic to strict. + - synopsis: Update mapping for an index with setting `dynamic` to `strict`. path: /{index}/_mapping method: PUT parameters: @@ -128,7 +128,7 @@ chapters: status: 200 payload: acknowledged: true - - synopsis: Update mapping for an index with setting dynamic to strict_allow_templates. + - synopsis: Update mapping for an index with setting dynamic to `strict_allow_templates`. version: '>= 2.16' path: /{index}/_mapping method: PUT