1
0
mirror of https://github.com/go-kit/kit.git synced 2025-07-15 01:04:44 +02:00

Merge pull request #583 from go-kit/instancer-stop

sd: add Stop method to Instancer interface
This commit is contained in:
Peter Bourgon
2017-09-17 13:23:13 -07:00
committed by GitHub
9 changed files with 17 additions and 23 deletions

View File

@ -19,9 +19,7 @@ func TestDefaultEndpointer(t *testing.T) {
f = func(instance string) (endpoint.Endpoint, io.Closer, error) {
return endpoint.Nop, c[instance], nil
}
instancer = &mockInstancer{
cache: instance.NewCache(),
}
instancer = &mockInstancer{instance.NewCache()}
)
// set initial state
instancer.Update(sd.Event{Instances: []string{"a", "b"}})
@ -69,21 +67,7 @@ func TestDefaultEndpointer(t *testing.T) {
// and therefore does not have access to the endpointer's private members.
}
type mockInstancer struct {
cache *instance.Cache
}
func (m *mockInstancer) Update(event sd.Event) {
m.cache.Update(event)
}
func (m *mockInstancer) Register(ch chan<- sd.Event) {
m.cache.Register(ch)
}
func (m *mockInstancer) Deregister(ch chan<- sd.Event) {
m.cache.Deregister(ch)
}
type mockInstancer struct{ *instance.Cache }
type closer chan struct{}