Move selector to client/selector

This commit is contained in:
Asim Aslam
2019-06-21 15:13:54 +01:00
parent c350e19552
commit ca5acba0c6
28 changed files with 21 additions and 21 deletions

View File

@@ -0,0 +1,31 @@
package selector
import (
"testing"
"github.com/micro/go-micro/registry/memory"
)
func TestRegistrySelector(t *testing.T) {
counts := map[string]int{}
r := memory.NewRegistry()
rg := r.(*memory.Registry)
rg.Services = testData
cache := NewSelector(Registry(r))
next, err := cache.Select("foo")
if err != nil {
t.Errorf("Unexpected error calling cache select: %v", err)
}
for i := 0; i < 100; i++ {
node, err := next()
if err != nil {
t.Errorf("Expected node err, got err: %v", err)
}
counts[node.Id]++
}
t.Logf("Selector Counts %v", counts)
}