Exemple #1
0
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")
	}
}
Exemple #2
0
Fichier : bus.go Projet : 40a/vega
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
}