You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
575 B
38 lines
575 B
package ping |
|
|
|
import ( |
|
"context" |
|
"flag" |
|
"path/filepath" |
|
"testing" |
|
"time" |
|
|
|
"go-common/app/interface/main/app-wall/conf" |
|
|
|
. "github.com/smartystreets/goconvey/convey" |
|
) |
|
|
|
var ( |
|
s *Service |
|
) |
|
|
|
func WithService(f func(s *Service)) func() { |
|
return func() { |
|
f(s) |
|
} |
|
} |
|
|
|
func init() { |
|
dir, _ := filepath.Abs("../../cmd/app-wall-test.toml") |
|
flag.Set("conf", dir) |
|
conf.Init() |
|
s = New(conf.Conf) |
|
time.Sleep(time.Second) |
|
} |
|
|
|
func TestPing(t *testing.T) { |
|
Convey("Unicom Ping", t, WithService(func(s *Service) { |
|
err := s.Ping(context.TODO()) |
|
So(err, ShouldBeNil) |
|
})) |
|
}
|
|
|