From 4e5454b82e8e8ebacd889a21dc9c166d2fdcafb3 Mon Sep 17 00:00:00 2001 From: dblock Date: Tue, 26 Nov 2024 08:52:09 -0500 Subject: [PATCH] Added tests for /_plugins/_flow_framework/workflow/_search and state/_search. Signed-off-by: dblock --- tests/default/flow_framework/deprovision.yaml | 10 ++--- tests/default/flow_framework/provision.yaml | 10 ++--- tests/default/flow_framework/search.yaml | 6 +-- .../default/flow_framework/search_state.yaml | 6 +-- tests/default/flow_framework/status.yaml | 8 ++-- tests/default/flow_framework/steps.yaml | 8 ++-- tests/default/flow_framework/template.yaml | 44 +++++++++---------- tests/default/flow_framework/workflow.yaml | 44 +++++++++---------- .../flow_framework/workflow/search.yaml | 36 +++++++++++++++ .../flow_framework/workflow/state/search.yaml | 36 +++++++++++++++ 10 files changed, 140 insertions(+), 68 deletions(-) create mode 100644 tests/default/flow_framework/workflow/search.yaml create mode 100644 tests/default/flow_framework/workflow/state/search.yaml 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 +