base_test.go 499 B

123456789101112131415161718192021222324252627282930
  1. package base
  2. import (
  3. "flag"
  4. "fmt"
  5. "path/filepath"
  6. "testing"
  7. "go-common/app/job/main/search/conf"
  8. . "github.com/smartystreets/goconvey/convey"
  9. )
  10. func WithBase(f func(b *Base)) func() {
  11. return func() {
  12. dir, _ := filepath.Abs("../dao/cmd/goconvey.toml")
  13. flag.Set("conf", dir)
  14. flag.Parse()
  15. conf.Init()
  16. d := NewBase(conf.Conf)
  17. f(d)
  18. }
  19. }
  20. func Test_NewAppPool(t *testing.T) {
  21. Convey("newAppPool", t, WithBase(func(b *Base) {
  22. pool := b.newAppPool(b.D)
  23. fmt.Println(pool)
  24. }))
  25. }