identify_test.go 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. . "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestServie_Ping(t *testing.T) {
  8. Convey("test identify consumer proc", t, func() {
  9. once.Do(startService)
  10. s.Ping(context.Background())
  11. })
  12. }
  13. func TestService_identify(t *testing.T) {
  14. Convey("test identify consumer proc", t, func() {
  15. once.Do(startService)
  16. var (
  17. bmsg interface{}
  18. err error
  19. res int
  20. )
  21. msg := <-s.identifySub.Messages()
  22. bmsg, err = s.identifyNew(msg)
  23. So(err, ShouldBeNil)
  24. So(bmsg, ShouldNotBeNil)
  25. res = s.identifySplit(msg, bmsg)
  26. So(res, ShouldNotBeNil)
  27. bmsgs := []interface{}{bmsg}
  28. s.processIdentifyInfo(bmsgs)
  29. })
  30. }
  31. func TestService_auth(t *testing.T) {
  32. Convey("test identify consumer proc", t, func() {
  33. once.Do(startService)
  34. var (
  35. m interface{}
  36. err error
  37. res int
  38. )
  39. msg := <-s.authDataBus.Messages()
  40. m, err = s.new(msg)
  41. So(err, ShouldBeNil)
  42. So(m, ShouldNotBeNil)
  43. res = s.spilt(msg, m)
  44. So(res, ShouldNotBeNil)
  45. ms := []interface{}{m}
  46. s.processIdentifyInfo(ms)
  47. })
  48. }