task_test.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/job/main/dm2/model"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestServicetaskResProc(t *testing.T) {
  9. convey.Convey("taskResProc", t, func(ctx convey.C) {
  10. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  11. svr.taskResProc()
  12. ctx.Convey("No return values", func(ctx convey.C) {
  13. })
  14. })
  15. })
  16. }
  17. func TestServicetaskDelProc(t *testing.T) {
  18. convey.Convey("taskDelProc", t, func(ctx convey.C) {
  19. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  20. svr.taskDelProc()
  21. ctx.Convey("No return values", func(ctx convey.C) {
  22. })
  23. })
  24. })
  25. }
  26. func TestServicetaskDelDM(t *testing.T) {
  27. convey.Convey("taskDelDM", t, func(ctx convey.C) {
  28. var (
  29. c = context.Background()
  30. task = &model.TaskInfo{
  31. Result: "http://berserker.bilibili.co/avenger/download/hdfs?path=/api/hive/query/148/672bc22888af701529e8b3052fd2c4a7/1543546463/1547966/result",
  32. }
  33. )
  34. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  35. delCount, lastIndex, state, err := svr.taskDelDM(c, task)
  36. ctx.Convey("Then err should be nil.delCount,pause should not be nil.", func(ctx convey.C) {
  37. ctx.So(err, convey.ShouldBeNil)
  38. ctx.So(state, convey.ShouldNotBeNil)
  39. ctx.So(delCount, convey.ShouldNotBeNil)
  40. t.Log(delCount, lastIndex, state)
  41. })
  42. })
  43. })
  44. }