Skip to content

Commit

Permalink
fix by comments
Browse files Browse the repository at this point in the history
Signed-off-by: LiZhenCheng9527 <lizhencheng6@huawei.com>
  • Loading branch information
LiZhenCheng9527 committed Apr 23, 2024
1 parent e3e137d commit d8070b0
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions pkg/cache/v2/listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -211,6 +211,10 @@ func BenchmarkFlush(b *testing.B) {
},
},
},
},
},
{
Filters: []*listener_v2.Filter{
{
Name: "filter2",
ConfigType: &listener_v2.Filter_TcpProxy{
Expand All @@ -223,6 +227,10 @@ func BenchmarkFlush(b *testing.B) {
},
},
},
},
},
{
Filters: []*listener_v2.Filter{
{
Name: "filter3",
ConfigType: &listener_v2.Filter_TcpProxy{
Expand All @@ -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),
},
Expand All @@ -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)

Expand Down

0 comments on commit d8070b0

Please sign in to comment.