func TestConsulPusher(t *testing.T) { serv, err := vega.NewMemService(cPort) if err != nil { panic(err) } defer serv.Close() go serv.Accept() cp := &consulPusher{nil, cPort} cp.Connect() cp.Declare("a") payload := vega.Msg([]byte("hello")) cp.Push("a", payload) msg, err := cp.Poll("a") if msg == nil || !msg.Message.Equal(payload) { t.Fatal("couldn't talk to the service") } }
func NewTestBus() *TestBus { serv, err := vega.NewMemService("127.0.0.1:0") if err != nil { panic(err) } tb := &TestBus{serv} go serv.Accept() return tb }