go-common/app/admin/ep/merlin/dao/mysql_task_test.go

37 lines
733 B
Go
Raw Permalink Normal View History

2019-04-22 10:49:16 +00:00
package dao
import (
"testing"
"time"
"go-common/app/admin/ep/merlin/model"
. "github.com/smartystreets/goconvey/convey"
)
var (
testMachine = model.Machine{
EndTime: time.Now().Add((-1) * time.Hour),
ID: 123123,
}
)
func Test_Task(t *testing.T) {
Convey("test InsertDeleteMachinesTasks", t, func() {
err := d.InsertDeleteMachinesTasks([]*model.Machine{&testMachine})
So(err, ShouldBeNil)
})
Convey("test FindDeleteMachineTasks", t, func() {
tasks, err := d.FindDeleteMachineTasks()
So(err, ShouldBeNil)
So(len(tasks), ShouldBeGreaterThan, 0)
})
Convey("test UpdateTaskStatusByMachines", t, func() {
err := d.UpdateTaskStatusByMachines([]int64{testMachine.ID}, 2)
So(err, ShouldBeNil)
})
}