Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Ortel <[email protected]>
  • Loading branch information
jortel committed Jan 17, 2025
1 parent 369ac92 commit 1c3a7d4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
8 changes: 4 additions & 4 deletions binding/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ func (h *Task) List() (list []api.Task, err error) {
return
}

// CancelMultipleTasks - Cancel multiple tasks by their IDs.
func (h *Task) CancelMultipleTasks(ids []uint) (err error) {
err = h.client.Put(api.TaskCancelListRoot, ids)
return
// BulkCancel - Cancel tasks matched by filter.
func (h *Task) BulkCancel(filter Filter) (err error) {
err = h.client.Put(api.TasksCancelRoot, 0, filter.Param())
return
}

// Update a Task.
Expand Down
11 changes: 11 additions & 0 deletions test/api/task/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"testing"
"time"

"github.com/konveyor/tackle2-hub/binding"
"github.com/konveyor/tackle2-hub/binding/filter"
"github.com/konveyor/tackle2-hub/test/assert"
)

Expand Down Expand Up @@ -110,3 +112,12 @@ func TestTaskList(t *testing.T) {
assert.Must(t, Task.Delete(r.ID))
}
}

func TestBulkCancel(t *testing.T) {
f := binding.Filter{}
f.And("id").Eq(filter.Any{1, 2, 3})
err := Task.BulkCancel(f)
if err != nil {
t.Errorf(err.Error())
}
}

0 comments on commit 1c3a7d4

Please sign in to comment.