service_test.go 666 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package Service
  2. import (
  3. "context"
  4. "go-common/app/job/live/wallet/conf"
  5. "os"
  6. "testing"
  7. "time"
  8. . "github.com/smartystreets/goconvey/convey"
  9. )
  10. func TestMain(m *testing.M) {
  11. conf.ConfPath = "../cmd/live-wallet-test.toml"
  12. once.Do(startService)
  13. os.Exit(m.Run())
  14. }
  15. func TestPing(t *testing.T) {
  16. Convey("Ping", t, func() {
  17. once.Do(startService)
  18. time.Sleep(time.Second)
  19. s.Ping(context.TODO())
  20. })
  21. }
  22. func TestClose(t *testing.T) {
  23. Convey("Close", t, func() {
  24. once.Do(startService)
  25. time.Sleep(time.Second)
  26. s.Close()
  27. })
  28. }
  29. func TestWait(t *testing.T) {
  30. Convey("Wait", t, func() {
  31. once.Do(startService)
  32. time.Sleep(time.Second)
  33. s.Wait()
  34. })
  35. }