service_test.go 636 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package dataflow
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "testing"
  7. "time"
  8. "go-common/app/interface/main/app-interface/conf"
  9. . "github.com/smartystreets/goconvey/convey"
  10. )
  11. var (
  12. s *Service
  13. )
  14. func init() {
  15. dir, _ := filepath.Abs("../cmd/app-interface-test.toml")
  16. flag.Set("conf", dir)
  17. conf.Init()
  18. s = New(conf.Conf)
  19. time.Sleep(time.Second)
  20. }
  21. func WithService(f func(s *Service)) func() {
  22. return func() {
  23. f(s)
  24. }
  25. }
  26. func TestReport(t *testing.T) {
  27. Convey("get app banner", t, WithService(func(s *Service) {
  28. err := s.Report(context.Background(), "1", "2", "3", "4", "5", time.Now())
  29. So(err, ShouldBeNil)
  30. }))
  31. }