diff --git a/manager/job/manager_tasks.go b/manager/job/manager_tasks.go index 44e45f5bc02..3e5bb4868dd 100644 --- a/manager/job/manager_tasks.go +++ b/manager/job/manager_tasks.go @@ -1,5 +1,5 @@ /* - * Copyright 2020 The Dragonfly Authors + * Copyright 2024 The Dragonfly Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -//go:generate mockgen -destination mocks/delete_task_mock.go -source delete_task.go -package mocks + +//go:generate mockgen -destination mocks/manager_tasks_mock.go -source manager_tasks.go -package mocks + package job import ( @@ -21,14 +23,15 @@ import ( "fmt" "time" + machineryv1tasks "github.com/RichardKnop/machinery/v1/tasks" + "github.com/google/uuid" + "go.opentelemetry.io/otel/trace" + logger "d7y.io/dragonfly/v2/internal/dflog" internaljob "d7y.io/dragonfly/v2/internal/job" "d7y.io/dragonfly/v2/manager/config" "d7y.io/dragonfly/v2/manager/models" "d7y.io/dragonfly/v2/manager/types" - machineryv1tasks "github.com/RichardKnop/machinery/v1/tasks" - "github.com/google/uuid" - "go.opentelemetry.io/otel/trace" ) // ManagerTask is an interface for delete and list tasks. diff --git a/manager/job/mocks/manager_tasks_mock.go b/manager/job/mocks/manager_tasks_mock.go new file mode 100644 index 00000000000..94f7e964271 --- /dev/null +++ b/manager/job/mocks/manager_tasks_mock.go @@ -0,0 +1,72 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: manager_tasks.go +// +// Generated by this command: +// +// mockgen -destination mocks/manager_tasks_mock.go -source manager_tasks.go -package mocks +// +// Package mocks is a generated GoMock package. +package mocks + +import ( + context "context" + reflect "reflect" + + job "d7y.io/dragonfly/v2/internal/job" + models "d7y.io/dragonfly/v2/manager/models" + types "d7y.io/dragonfly/v2/manager/types" + gomock "github.com/golang/mock/gomock" +) + +// MockManagerTasks is a mock of ManagerTasks interface. +type MockManagerTasks struct { + ctrl *gomock.Controller + recorder *MockManagerTasksMockRecorder +} + +// MockManagerTasksMockRecorder is the mock recorder for MockManagerTasks. +type MockManagerTasksMockRecorder struct { + mock *MockManagerTasks +} + +// NewMockManagerTasks creates a new mock instance. +func NewMockManagerTasks(ctrl *gomock.Controller) *MockManagerTasks { + mock := &MockManagerTasks{ctrl: ctrl} + mock.recorder = &MockManagerTasksMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockManagerTasks) EXPECT() *MockManagerTasksMockRecorder { + return m.recorder +} + +// CreateDeleteTask mocks base method. +func (m *MockManagerTasks) CreateDeleteTask(arg0 context.Context, arg1 []models.Scheduler, arg2 types.DeleteTasksArgs) (*job.GroupJobState, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateDeleteTask", arg0, arg1, arg2) + ret0, _ := ret[0].(*job.GroupJobState) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateDeleteTask indicates an expected call of CreateDeleteTask. +func (mr *MockManagerTasksMockRecorder) CreateDeleteTask(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateDeleteTask", reflect.TypeOf((*MockManagerTasks)(nil).CreateDeleteTask), arg0, arg1, arg2) +} + +// CreateListTasks mocks base method. +func (m *MockManagerTasks) CreateListTasks(arg0 context.Context, arg1 []models.Scheduler, arg2 types.ListTasksArgs) (*job.GroupJobState, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateListTasks", arg0, arg1, arg2) + ret0, _ := ret[0].(*job.GroupJobState) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateListTasks indicates an expected call of CreateListTasks. +func (mr *MockManagerTasksMockRecorder) CreateListTasks(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateListTasks", reflect.TypeOf((*MockManagerTasks)(nil).CreateListTasks), arg0, arg1, arg2) +}