micro/registry/memory/watcher_test.go
Vasiliy Tolstov 06136312bb
regen files with never protoc (#6)
* regen files with never protoc
* rewrite import path

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-08-19 17:47:17 +03:00

36 lines
547 B
Go

package memory
import (
"testing"
"github.com/unistack-org/micro/v3/registry"
)
func TestWatcher(t *testing.T) {
w := &Watcher{
id: "test",
res: make(chan *registry.Result),
exit: make(chan bool),
wo: registry.WatchOptions{
Domain: registry.WildcardDomain,
},
}
go func() {
w.res <- &registry.Result{
Service: &registry.Service{Name: "foo"},
}
}()
_, 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()")
}
}