appres_test.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package push
  2. import (
  3. "context"
  4. "fmt"
  5. "testing"
  6. "go-common/app/interface/main/app-resource/api/v1"
  7. "github.com/smartystreets/goconvey/convey"
  8. )
  9. func TestPusherrlog(t *testing.T) {
  10. var (
  11. step = ""
  12. err error
  13. )
  14. convey.Convey("errlog", t, func(ctx convey.C) {
  15. errlog(step, err)
  16. ctx.Convey("No return values", func(ctx convey.C) {
  17. })
  18. })
  19. }
  20. func TestPushgrpcClient(t *testing.T) {
  21. var (
  22. grpcAddrs []string
  23. err error
  24. p1 v1.AppResourceClient
  25. )
  26. convey.Convey("pickAddrs", t, func(ctx convey.C) {
  27. grpcAddrs, err = d.pickAddrs()
  28. ctx.Convey("Then err should be nil.grpcAddrs should not be nil.", func(ctx convey.C) {
  29. ctx.So(err, convey.ShouldBeNil)
  30. ctx.So(grpcAddrs, convey.ShouldNotBeNil)
  31. })
  32. })
  33. convey.Convey("grpcClient", t, func(ctx convey.C) {
  34. fmt.Println("Call ", grpcAddrs[0])
  35. p1, err = d.grpcClient(grpcAddrs[0])
  36. ctx.Convey("Then err should be nil.p1 should not be nil.", func(ctx convey.C) {
  37. ctx.So(err, convey.ShouldBeNil)
  38. ctx.So(p1, convey.ShouldNotBeNil)
  39. })
  40. })
  41. convey.Convey("callRefresh", t, func(ctx convey.C) {
  42. err = d.CallRefresh(context.Background())
  43. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  44. ctx.So(err, convey.ShouldBeNil)
  45. })
  46. })
  47. }