1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-18 08:26:38 +02:00
go-micro/registry/memory/watcher_test.go

31 lines
426 B
Go
Raw Normal View History

2019-01-18 19:29:17 +02:00
package memory
import (
"testing"
"github.com/micro/go-micro/v2/registry"
2019-01-18 19:29:17 +02:00
)
func TestWatcher(t *testing.T) {
w := &Watcher{
id: "test",
res: make(chan *registry.Result),
exit: make(chan bool),
}
go func() {
w.res <- &registry.Result{}
}()
_, err := w.Next()
if err != nil {
t.Fatal("unexpected err", err)
}
w.Stop()
if _, err := w.Next(); err == nil {
t.Fatal("expected error on Next()")
}
}