feat(task): 暴露任务取消控制状态
This commit is contained in:
@@ -76,3 +76,26 @@ func TestTaskCancelUnavailableReportsSubmittedFromRemoteTaskID(t *testing.T) {
|
||||
t.Fatalf("remote task id should report submitted: %+v", result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDescribeTaskCancellationReportsQueuedTaskAsCancellable(t *testing.T) {
|
||||
result := DescribeTaskCancellation(store.GatewayTask{ID: "task-queued", Status: "queued"})
|
||||
|
||||
if result.TaskID != "task-queued" {
|
||||
t.Fatalf("unexpected task id: %+v", result)
|
||||
}
|
||||
if result.Cancelled || !result.Cancellable || result.Submitted {
|
||||
t.Fatalf("queued local task should be cancellable and not submitted: %+v", result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDescribeTaskCancellationReportsRemoteTaskAsSubmitted(t *testing.T) {
|
||||
result := DescribeTaskCancellation(store.GatewayTask{
|
||||
ID: "task-remote",
|
||||
Status: "running",
|
||||
RemoteTaskID: "remote-1",
|
||||
})
|
||||
|
||||
if result.Cancelled || result.Cancellable || !result.Submitted {
|
||||
t.Fatalf("remote task should be submitted and non-cancellable: %+v", result)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user