@@ -491,9 +491,8 @@ func TestBuildServiceMetricsToPrometheus(t *testing.T) {
491491
492492func TestBuildConnectionMetricsToPrometheus (t * testing.T ) {
493493 type args struct {
494- data requestMetric
495- labels connectionMetricLabels
496- tcpConns map [connectionSrcDst ]connMetric
494+ data requestMetric
495+ labels connectionMetricLabels
497496 }
498497 tests := []struct {
499498 id int32
@@ -542,26 +541,6 @@ func TestBuildConnectionMetricsToPrometheus(t *testing.T) {
542541 responseFlags : "-" ,
543542 connectionSecurityPolicy : "mutual_tls" ,
544543 },
545- tcpConns : map [connectionSrcDst ]connMetric {
546- {
547- src : [4 ]uint32 {183763210 , 0 , 0 , 0 },
548- dst : [4 ]uint32 {183762951 , 0 , 0 , 0 },
549- direction : constants .INBOUND ,
550- }: {
551- sentBytes : 0x0000003 ,
552- receivedBytes : 0x0000004 ,
553- packetLost : 0x0000001 ,
554- totalRetrans : 0x0000002 ,
555- totalReports : 1 ,
556- },
557- {
558- src : [4 ]uint32 {183763210 , 0 , 0 , 0 },
559- dst : [4 ]uint32 {183762951 , 0 , 0 , 0 },
560- direction : constants .OUTBOUND ,
561- }: {
562- totalReports : 3 ,
563- },
564- },
565544 },
566545 want : []float64 {
567546 3 ,
@@ -611,26 +590,6 @@ func TestBuildConnectionMetricsToPrometheus(t *testing.T) {
611590 responseFlags : "-" ,
612591 connectionSecurityPolicy : "mutual_tls" ,
613592 },
614- tcpConns : map [connectionSrcDst ]connMetric {
615- {
616- src : [4 ]uint32 {183763210 , 0 , 0 , 0 },
617- dst : [4 ]uint32 {183762951 , 0 , 0 , 0 },
618- direction : constants .INBOUND ,
619- }: {
620- sentBytes : 0x0000003 ,
621- receivedBytes : 0x0000004 ,
622- packetLost : 0x0000001 ,
623- totalRetrans : 0x0000002 ,
624- totalReports : 1 ,
625- },
626- {
627- src : [4 ]uint32 {183763210 , 0 , 0 , 0 },
628- dst : [4 ]uint32 {183762951 , 0 , 0 , 0 },
629- direction : constants .OUTBOUND ,
630- }: {
631- totalReports : 3 ,
632- },
633- },
634593 },
635594 want : []float64 {
636595 4 ,
@@ -681,7 +640,7 @@ func TestBuildConnectionMetricsToPrometheus(t *testing.T) {
681640 }
682641
683642 deleteConnection = []* connectionMetricLabels {}
684- m .updateConnectionMetricCache (tt .args .data , tt .args .tcpConns [ tt . args . data . conSrcDstInfo ], tt . args . labels )
643+ m .updateConnectionMetricCache (tt .args .data , tt .args .labels )
685644 assert .Equal (t , m .connectionMetricCache [tt .args .labels ].ConnSentBytes , tt .want [0 ])
686645 assert .Equal (t , m .connectionMetricCache [tt .args .labels ].ConnReceivedBytes , tt .want [1 ])
687646 assert .Equal (t , m .connectionMetricCache [tt .args .labels ].ConnPacketLost , tt .want [2 ])
0 commit comments