service_test.go 407 B

1234567891011121314151617181920212223242526272829
  1. package service
  2. import (
  3. "sync"
  4. "testing"
  5. "go-common/app/job/main/passport-game-local/conf"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. var (
  9. once sync.Once
  10. s *Service
  11. )
  12. func startService() {
  13. if err := conf.Init(); err != nil {
  14. panic(err)
  15. }
  16. s = New(conf.Conf)
  17. }
  18. func TestNew(t *testing.T) {
  19. once.Do(startService)
  20. Convey("ping should ok", t, func() {
  21. So(s.Ping, ShouldBeNil)
  22. })
  23. }