1
0
mirror of https://github.com/go-kit/kit.git synced 2025-07-15 01:04:44 +02:00
Files
go-kit/sd/benchmark_test.go
Chris Hines 801da84a68 Replace kit/log with log (#1173)
* Implement log/... packages with github.com/go-kit/log

* Use github.com/go-kit/log/... in all the other packages
2021-08-18 17:15:32 +02:00

30 lines
600 B
Go

package sd
import (
"io"
"testing"
"github.com/go-kit/kit/endpoint"
"github.com/go-kit/log"
)
func BenchmarkEndpoints(b *testing.B) {
var (
ca = make(closer)
cb = make(closer)
cmap = map[string]io.Closer{"a": ca, "b": cb}
factory = func(instance string) (endpoint.Endpoint, io.Closer, error) { return endpoint.Nop, cmap[instance], nil }
c = newEndpointCache(factory, log.NewNopLogger(), endpointerOptions{})
)
b.ReportAllocs()
c.Update(Event{Instances: []string{"a", "b"}})
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
c.Endpoints()
}
})
}