task_state_test.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. package archive
  2. import (
  3. "context"
  4. "testing"
  5. "time"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func Test_UpGtimeByID(t *testing.T) {
  9. Convey("UpGtimeByID", t, WithDao(func(d *Dao) {
  10. _, err := d.UpGtimeByID(context.Background(), 0, "")
  11. So(err, ShouldBeNil)
  12. }))
  13. }
  14. func Test_TxUpTaskByID(t *testing.T) {
  15. var c = context.Background()
  16. Convey("TxUpTaskByID", t, WithDao(func(d *Dao) {
  17. tx, _ := d.BeginTran(c)
  18. _, err := d.TxUpTaskByID(tx, 0, map[string]interface{}{"id": 0})
  19. So(err, ShouldBeNil)
  20. tx.Commit()
  21. }))
  22. }
  23. func Test_TxReleaseByID(t *testing.T) {
  24. var c = context.Background()
  25. Convey("TxReleaseByID", t, WithDao(func(d *Dao) {
  26. tx, _ := d.BeginTran(c)
  27. _, err := d.TxReleaseByID(tx, 0)
  28. So(err, ShouldBeNil)
  29. tx.Commit()
  30. }))
  31. }
  32. func Test_MulReleaseMtime(t *testing.T) {
  33. var c = context.Background()
  34. Convey("MulReleaseMtime", t, WithDao(func(d *Dao) {
  35. _, err := d.MulReleaseMtime(c, []int64{1, 2}, time.Now())
  36. So(err, ShouldBeNil)
  37. }))
  38. }
  39. func Test_GetTimeOutTask(t *testing.T) {
  40. var c = context.Background()
  41. Convey("GetTimeOutTask", t, WithDao(func(d *Dao) {
  42. _, err := d.GetTimeOutTask(c)
  43. So(err, ShouldBeNil)
  44. }))
  45. }
  46. func Test_GetRelTask(t *testing.T) {
  47. var c = context.Background()
  48. Convey("GetRelTask", t, WithDao(func(d *Dao) {
  49. _, _, err := d.GetRelTask(c, 0)
  50. So(err, ShouldBeNil)
  51. }))
  52. }
  53. func Test_TxReleaseSpecial(t *testing.T) {
  54. var c = context.Background()
  55. Convey("TxReleaseSpecial", t, WithDao(func(d *Dao) {
  56. tx, _ := d.BeginTran(c)
  57. _, err := d.TxReleaseSpecial(tx, time.Now(), 0, 0, 0)
  58. So(err, ShouldBeNil)
  59. tx.Commit()
  60. }))
  61. }