service_test.go 481 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package service
  2. import (
  3. "context"
  4. "flag"
  5. "os"
  6. "testing"
  7. "go-common/app/job/main/block/conf"
  8. . "github.com/smartystreets/goconvey/convey"
  9. )
  10. var (
  11. s *Service
  12. c context.Context
  13. )
  14. func TestMain(m *testing.M) {
  15. defer os.Exit(0)
  16. flag.Set("conf", "../cmd/block-job-test.toml")
  17. var err error
  18. if err = conf.Init(); err != nil {
  19. panic(err)
  20. }
  21. s = New()
  22. defer s.Close()
  23. m.Run()
  24. }
  25. func TestService(t *testing.T) {
  26. Convey("", t, func() {
  27. s.Ping(c)
  28. s.Close()
  29. })
  30. }