service_test.go 659 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package service
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "testing"
  7. "time"
  8. "go-common/app/job/main/upload/conf"
  9. . "github.com/smartystreets/goconvey/convey"
  10. )
  11. var (
  12. s *Service
  13. )
  14. func init() {
  15. dir, _ := filepath.Abs("../cmd/bfs-upload-job.toml")
  16. flag.Set("conf", dir)
  17. conf.Init()
  18. s = New(conf.Conf)
  19. time.Sleep(time.Second)
  20. }
  21. func TestPing(t *testing.T) {
  22. Convey("Ping", t, func() {
  23. err := s.Ping(context.TODO())
  24. So(err, ShouldBeNil)
  25. })
  26. }
  27. func TestRetryAddRecord(t *testing.T) {
  28. }
  29. func TestRun(t *testing.T) {
  30. Convey("Run", t, func() {
  31. Run(s.c)
  32. })
  33. }
  34. func TestClose(t *testing.T) {
  35. Convey("Close", t, func() {
  36. s.Close()
  37. })
  38. }