mysql_task_test.go 733 B

123456789101112131415161718192021222324252627282930313233343536
  1. package dao
  2. import (
  3. "testing"
  4. "time"
  5. "go-common/app/admin/ep/merlin/model"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. var (
  9. testMachine = model.Machine{
  10. EndTime: time.Now().Add((-1) * time.Hour),
  11. ID: 123123,
  12. }
  13. )
  14. func Test_Task(t *testing.T) {
  15. Convey("test InsertDeleteMachinesTasks", t, func() {
  16. err := d.InsertDeleteMachinesTasks([]*model.Machine{&testMachine})
  17. So(err, ShouldBeNil)
  18. })
  19. Convey("test FindDeleteMachineTasks", t, func() {
  20. tasks, err := d.FindDeleteMachineTasks()
  21. So(err, ShouldBeNil)
  22. So(len(tasks), ShouldBeGreaterThan, 0)
  23. })
  24. Convey("test UpdateTaskStatusByMachines", t, func() {
  25. err := d.UpdateTaskStatusByMachines([]int64{testMachine.ID}, 2)
  26. So(err, ShouldBeNil)
  27. })
  28. }