mirror of
https://github.com/go-micro/go-micro.git
synced 2024-11-30 08:06:40 +02:00
f23638c036
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
31 lines
426 B
Go
31 lines
426 B
Go
package memory
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/micro/go-micro/v2/registry"
|
|
)
|
|
|
|
func TestWatcher(t *testing.T) {
|
|
w := &Watcher{
|
|
id: "test",
|
|
res: make(chan *registry.Result),
|
|
exit: make(chan bool),
|
|
}
|
|
|
|
go func() {
|
|
w.res <- ®istry.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()")
|
|
}
|
|
}
|