diff --git a/pkg/endpoints/endponts_bench_test.go b/pkg/endpoints/endponts_bench_test.go new file mode 100644 index 00000000..d101c9a7 --- /dev/null +++ b/pkg/endpoints/endponts_bench_test.go @@ -0,0 +1,20 @@ +package endpoints + +import ( + "context" + "testing" +) + +func BenchmarkEndpointGroup(b *testing.B) { + e := newEndpointGroup() + e.setIPs(map[string]struct{}{"10.0.0.1": {}}, map[string]int32{"testPort": 1}) + b.ResetTimer() + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + _, err := e.getBestHost(context.Background(), "testPort") + if err != nil { + b.Fatal(err) + } + } + }) +}