From dc41b129332190fdb50e09bf708ac369dbc9bea9 Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Wed, 18 Dec 2024 01:19:45 -0500 Subject: [PATCH] Added missing task tests. (#746) Signed-off-by: dblock --- tests/default/_core/tasks.yaml | 39 +++++++++++++++++++++++++++ tests/default/_core/tasks/cancel.yaml | 33 +++++++++++++++++++++++ tests/default/tasks/list.yaml | 25 ----------------- 3 files changed, 72 insertions(+), 25 deletions(-) create mode 100644 tests/default/_core/tasks.yaml create mode 100644 tests/default/_core/tasks/cancel.yaml delete mode 100644 tests/default/tasks/list.yaml diff --git a/tests/default/_core/tasks.yaml b/tests/default/_core/tasks.yaml new file mode 100644 index 000000000..3c40bd605 --- /dev/null +++ b/tests/default/_core/tasks.yaml @@ -0,0 +1,39 @@ +$schema: ../../../json_schemas/test_story.schema.yaml + +description: Test tasks endpoint. +prologues: + - path: /books/_delete_by_query + id: task + method: POST + parameters: + refresh: true + conflicts: proceed + wait_for_completion: false + request: + payload: + query: + match_all: {} + output: + id: payload.task +chapters: + - synopsis: List tasks grouped by node. + path: /_tasks + method: GET + parameters: + group_by: nodes + - synopsis: List tasks grouped by parent. + path: /_tasks + method: GET + parameters: + group_by: parents + - synopsis: List tasks grouped by none. + path: /_tasks + method: GET + parameters: + group_by: none + - synopsis: Get task by id. + id: task + path: /_tasks/{task_id} + method: GET + parameters: + task_id: ${task.id} diff --git a/tests/default/_core/tasks/cancel.yaml b/tests/default/_core/tasks/cancel.yaml new file mode 100644 index 000000000..d1100f784 --- /dev/null +++ b/tests/default/_core/tasks/cancel.yaml @@ -0,0 +1,33 @@ +$schema: ../../../../json_schemas/test_story.schema.yaml + +description: Test tasks endpoint. +prologues: + - path: /books/_delete_by_query + id: task + method: POST + parameters: + refresh: true + conflicts: proceed + wait_for_completion: false + request: + payload: + query: + match_all: {} + output: + id: payload.task +chapters: + - synopsis: Cancel all tasks. + path: /_tasks/_cancel + method: POST + - synopsis: Cancel a task. + path: /_tasks/{task_id}/_cancel + method: POST + parameters: + task_id: ${task.id} + response: + status: 200 + payload: + node_failures: + - type: failed_node_exception + caused_by: + type: resource_not_found_exception diff --git a/tests/default/tasks/list.yaml b/tests/default/tasks/list.yaml deleted file mode 100644 index a687e170c..000000000 --- a/tests/default/tasks/list.yaml +++ /dev/null @@ -1,25 +0,0 @@ -$schema: ../../../json_schemas/test_story.schema.yaml - -description: Test tasks list endpoint. -chapters: - - synopsis: List tasks grouped by node. - path: /_tasks - method: GET - parameters: - group_by: nodes - response: - status: 200 - - synopsis: List tasks grouped by parent. - path: /_tasks - method: GET - parameters: - group_by: parents - response: - status: 200 - - synopsis: List tasks grouped by none. - path: /_tasks - method: GET - parameters: - group_by: none - response: - status: 200 \ No newline at end of file