service_test.go 398 B

1234567891011121314151617181920212223242526272829
  1. package service
  2. import (
  3. "flag"
  4. "os"
  5. "path/filepath"
  6. "testing"
  7. "go-common/app/interface/main/upload/conf"
  8. )
  9. var (
  10. svr *Service
  11. )
  12. func TestMain(m *testing.M) {
  13. var (
  14. err error
  15. )
  16. dir, _ := filepath.Abs("../cmd/upload-test.toml")
  17. if err = flag.Set("conf", dir); err != nil {
  18. panic(err)
  19. }
  20. if err = conf.Init(); err != nil {
  21. panic(err)
  22. }
  23. svr = New(conf.Conf)
  24. os.Exit(m.Run())
  25. }