diff --git a/pkg/cache/v2/listener_test.go b/pkg/cache/v2/listener_test.go index 72b8e9251..30554ca6b 100644 --- a/pkg/cache/v2/listener_test.go +++ b/pkg/cache/v2/listener_test.go @@ -188,7 +188,7 @@ func TestListenerFlush(t *testing.T) { func BenchmarkFlush(b *testing.B) { t := &testing.T{} test.InitBpfMap(t) - t.Cleanup(test.CleanupBpfMap) + b.Cleanup(test.CleanupBpfMap) listener := &listener_v2.Listener{ ApiStatus: core_v2.ApiStatus_UPDATE, @@ -211,6 +211,10 @@ func BenchmarkFlush(b *testing.B) { }, }, }, + }, + }, + { + Filters: []*listener_v2.Filter{ { Name: "filter2", ConfigType: &listener_v2.Filter_TcpProxy{ @@ -223,6 +227,10 @@ func BenchmarkFlush(b *testing.B) { }, }, }, + }, + }, + { + Filters: []*listener_v2.Filter{ { Name: "filter3", ConfigType: &listener_v2.Filter_TcpProxy{ @@ -235,25 +243,33 @@ func BenchmarkFlush(b *testing.B) { }, }, }, + }, + }, + { + Filters: []*listener_v2.Filter{ { Name: "filter4", ConfigType: &listener_v2.Filter_TcpProxy{ TcpProxy: &filter.TcpProxy{ - StatPrefix: "outbound|8080||kube-dns.kube-system.svc.cluster.local", + StatPrefix: "outbound|9090||kube-dns.kube-system.svc.cluster.local", ClusterSpecifier: &filter.TcpProxy_Cluster{ - Cluster: "outbound|8080||kube-dns.kube-system.svc.cluster.local", + Cluster: "outbound|9090||kube-dns.kube-system.svc.cluster.local", }, MaxConnectAttempts: uint32(60), }, }, }, + }, + }, + { + Filters: []*listener_v2.Filter{ { Name: "filter5", ConfigType: &listener_v2.Filter_TcpProxy{ TcpProxy: &filter.TcpProxy{ - StatPrefix: "outbound|9898||kube-dns.kube-system.svc.cluster.local", + StatPrefix: "outbound|15001||kube-dns.kube-system.svc.cluster.local", ClusterSpecifier: &filter.TcpProxy_Cluster{ - Cluster: "outbound|9898||kube-dns.kube-system.svc.cluster.local", + Cluster: "outbound|15001||kube-dns.kube-system.svc.cluster.local", }, MaxConnectAttempts: uint32(60), }, @@ -267,6 +283,7 @@ func BenchmarkFlush(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { cache := NewListenerCache() + listener.ApiStatus = core_v2.ApiStatus_UPDATE listener.Name = rand.String(6) cache.SetApiListener(listener.Name, listener)