44 "context"
55 "fmt"
66 "os"
7- "strconv"
87 "strings"
98 "testing"
109 "time"
@@ -37,7 +36,7 @@ func TestMain(m *testing.M) {
3736// requesting, and the test will pass.
3837func TestCliStatForLinkerdNamespace (t * testing.T ) {
3938 ctx := context .Background ()
40- var prometheusPod , prometheusAuthority , prometheusNamespace , prometheusDeployment , metricsPod string
39+ var prometheusPod , prometheusNamespace , prometheusDeployment , metricsPod string
4140 // Get Metrics Pod
4241 pods , err := TestHelper .GetPodNamesForDeployment (ctx , TestHelper .GetVizNamespace (), "metrics-api" )
4342 if err != nil {
@@ -62,13 +61,11 @@ func TestCliStatForLinkerdNamespace(t *testing.T) {
6261 testutil .Fatalf (t , "expected 1 pod for prometheus, got %d" , len (pods ))
6362 }
6463 prometheusPod = pods [0 ]
65- prometheusAuthority = prometheusDeployment + "." + prometheusNamespace + ".svc.cluster.local:9090"
6664
6765 testCases := []struct {
6866 args []string
6967 expectedRows map [string ]string
7068 status string
71- isAuthority bool
7269 }{
7370 {
7471 args : []string {"viz" , "stat" , "deploy" , "-n" , TestHelper .GetLinkerdNamespace ()},
@@ -103,35 +100,13 @@ func TestCliStatForLinkerdNamespace(t *testing.T) {
103100 "metrics-api" : "1/1" ,
104101 },
105102 },
106- {
107- args : []string {"viz" , "stat" , "po" , "-n" , TestHelper .GetVizNamespace (), "--to" , fmt .Sprintf ("au/%s" , prometheusAuthority ), "--to-namespace" , prometheusNamespace },
108- expectedRows : map [string ]string {
109- metricsPod : "1/1" ,
110- },
111- status : "Running" ,
112- },
113- {
114- args : []string {"viz" , "stat" , "au" , "-n" , TestHelper .GetVizNamespace (), "--to" , fmt .Sprintf ("po/%s" , prometheusPod ), "--to-namespace" , prometheusNamespace },
115- expectedRows : map [string ]string {
116- prometheusAuthority : "-" ,
117- },
118- isAuthority : true ,
119- },
120- {
121- args : []string {"viz" , "stat" , "au" , "-n" , TestHelper .GetVizNamespace (), "--to" , fmt .Sprintf ("po/%s" , prometheusPod ), "--to-namespace" , prometheusNamespace },
122- expectedRows : map [string ]string {
123- prometheusAuthority : "-" ,
124- },
125- isAuthority : true ,
126- },
127103 }
128104
129105 if ! TestHelper .ExternalPrometheus () {
130106 testCases = append (testCases , []struct {
131107 args []string
132108 expectedRows map [string ]string
133109 status string
134- isAuthority bool
135110 }{
136111 {
137112 args : []string {"viz" , "stat" , "deploy" , "-n" , TestHelper .GetVizNamespace ()},
@@ -162,7 +137,6 @@ func TestCliStatForLinkerdNamespace(t *testing.T) {
162137 args []string
163138 expectedRows map [string ]string
164139 status string
165- isAuthority bool
166140 }{
167141 {
168142 args : []string {"viz" , "stat" , "deploy" , "-n" , TestHelper .GetVizNamespace ()},
@@ -212,7 +186,6 @@ func TestCliStatForLinkerdNamespace(t *testing.T) {
212186 args []string
213187 expectedRows map [string ]string
214188 status string
215- isAuthority bool
216189 }{
217190 {
218191 args : []string {"viz" , "stat" , "svc" , "-n" , prefixedNs },
@@ -244,9 +217,6 @@ func TestCliStatForLinkerdNamespace(t *testing.T) {
244217 }
245218
246219 expectedColumnCount := 8
247- if tt .isAuthority {
248- expectedColumnCount = 7
249- }
250220 if tt .status != "" {
251221 expectedColumnCount ++
252222 }
@@ -256,7 +226,7 @@ func TestCliStatForLinkerdNamespace(t *testing.T) {
256226 }
257227
258228 for name , meshed := range tt .expectedRows {
259- if err := validateRowStats (name , meshed , tt .status , rowStats , tt . isAuthority ); err != nil {
229+ if err := validateRowStats (name , meshed , tt .status , rowStats ); err != nil {
260230 return err
261231 }
262232 }
@@ -271,7 +241,7 @@ func TestCliStatForLinkerdNamespace(t *testing.T) {
271241 })
272242}
273243
274- func validateRowStats (name , expectedMeshCount , expectedStatus string , rowStats map [string ]* testutil.RowStat , isAuthority bool ) error {
244+ func validateRowStats (name , expectedMeshCount , expectedStatus string , rowStats map [string ]* testutil.RowStat ) error {
275245 stat , ok := rowStats [name ]
276246 if ! ok {
277247 return fmt .Errorf ("no stats found for [%s]" , name )
@@ -313,12 +283,5 @@ func validateRowStats(name, expectedMeshCount, expectedStatus string, rowStats m
313283 name , stat .P99Latency )
314284 }
315285
316- if stat .TCPOpenConnections != "-" && ! isAuthority {
317- _ , err := strconv .Atoi (stat .TCPOpenConnections )
318- if err != nil {
319- return fmt .Errorf ("error parsing number of TCP connections [%s]: %w" , stat .TCPOpenConnections , err )
320- }
321- }
322-
323286 return nil
324287}
0 commit comments