Skip to content

Commit 1ca4efc

Browse files
committed
fix integration tests
Signed-off-by: Zahari Dichev <[email protected]>
1 parent 6b25a98 commit 1ca4efc

File tree

2 files changed

+4
-62
lines changed

2 files changed

+4
-62
lines changed

test/integration/external/stat/stat_test.go

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"fmt"
66
"os"
7-
"strconv"
87
"strings"
98
"testing"
109
"time"
@@ -68,7 +67,6 @@ func TestCliStatForLinkerdNamespace(t *testing.T) {
6867
args []string
6968
expectedRows map[string]string
7069
status string
71-
isAuthority bool
7270
}{
7371
{
7472
args: []string{"viz", "stat", "deploy", "-n", TestHelper.GetLinkerdNamespace()},
@@ -110,28 +108,13 @@ func TestCliStatForLinkerdNamespace(t *testing.T) {
110108
},
111109
status: "Running",
112110
},
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-
},
127111
}
128112

129113
if !TestHelper.ExternalPrometheus() {
130114
testCases = append(testCases, []struct {
131115
args []string
132116
expectedRows map[string]string
133117
status string
134-
isAuthority bool
135118
}{
136119
{
137120
args: []string{"viz", "stat", "deploy", "-n", TestHelper.GetVizNamespace()},
@@ -162,7 +145,6 @@ func TestCliStatForLinkerdNamespace(t *testing.T) {
162145
args []string
163146
expectedRows map[string]string
164147
status string
165-
isAuthority bool
166148
}{
167149
{
168150
args: []string{"viz", "stat", "deploy", "-n", TestHelper.GetVizNamespace()},
@@ -212,7 +194,6 @@ func TestCliStatForLinkerdNamespace(t *testing.T) {
212194
args []string
213195
expectedRows map[string]string
214196
status string
215-
isAuthority bool
216197
}{
217198
{
218199
args: []string{"viz", "stat", "svc", "-n", prefixedNs},
@@ -244,9 +225,6 @@ func TestCliStatForLinkerdNamespace(t *testing.T) {
244225
}
245226

246227
expectedColumnCount := 8
247-
if tt.isAuthority {
248-
expectedColumnCount = 7
249-
}
250228
if tt.status != "" {
251229
expectedColumnCount++
252230
}
@@ -256,7 +234,7 @@ func TestCliStatForLinkerdNamespace(t *testing.T) {
256234
}
257235

258236
for name, meshed := range tt.expectedRows {
259-
if err := validateRowStats(name, meshed, tt.status, rowStats, tt.isAuthority); err != nil {
237+
if err := validateRowStats(name, meshed, tt.status, rowStats); err != nil {
260238
return err
261239
}
262240
}
@@ -271,7 +249,7 @@ func TestCliStatForLinkerdNamespace(t *testing.T) {
271249
})
272250
}
273251

274-
func validateRowStats(name, expectedMeshCount, expectedStatus string, rowStats map[string]*testutil.RowStat, isAuthority bool) error {
252+
func validateRowStats(name, expectedMeshCount, expectedStatus string, rowStats map[string]*testutil.RowStat) error {
275253
stat, ok := rowStats[name]
276254
if !ok {
277255
return fmt.Errorf("no stats found for [%s]", name)
@@ -313,12 +291,5 @@ func validateRowStats(name, expectedMeshCount, expectedStatus string, rowStats m
313291
name, stat.P99Latency)
314292
}
315293

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-
323294
return nil
324295
}

test/integration/viz/stat/stat_test.go

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"fmt"
66
"os"
7-
"strconv"
87
"strings"
98
"testing"
109
"time"
@@ -68,7 +67,6 @@ func TestCliStatForLinkerdNamespace(t *testing.T) {
6867
args []string
6968
expectedRows map[string]string
7069
status string
71-
isAuthority bool
7270
}{
7371
{
7472
args: []string{"viz", "stat", "deploy", "-n", TestHelper.GetLinkerdNamespace()},
@@ -110,28 +108,13 @@ func TestCliStatForLinkerdNamespace(t *testing.T) {
110108
},
111109
status: "Running",
112110
},
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-
},
127111
}
128112

129113
if !TestHelper.ExternalPrometheus() {
130114
testCases = append(testCases, []struct {
131115
args []string
132116
expectedRows map[string]string
133117
status string
134-
isAuthority bool
135118
}{
136119
{
137120
args: []string{"viz", "stat", "deploy", "-n", TestHelper.GetVizNamespace()},
@@ -162,7 +145,6 @@ func TestCliStatForLinkerdNamespace(t *testing.T) {
162145
args []string
163146
expectedRows map[string]string
164147
status string
165-
isAuthority bool
166148
}{
167149
{
168150
args: []string{"viz", "stat", "deploy", "-n", TestHelper.GetVizNamespace()},
@@ -212,7 +194,6 @@ func TestCliStatForLinkerdNamespace(t *testing.T) {
212194
args []string
213195
expectedRows map[string]string
214196
status string
215-
isAuthority bool
216197
}{
217198
{
218199
args: []string{"viz", "stat", "svc", "-n", prefixedNs},
@@ -244,9 +225,6 @@ func TestCliStatForLinkerdNamespace(t *testing.T) {
244225
}
245226

246227
expectedColumnCount := 8
247-
if tt.isAuthority {
248-
expectedColumnCount = 7
249-
}
250228
if tt.status != "" {
251229
expectedColumnCount++
252230
}
@@ -256,7 +234,7 @@ func TestCliStatForLinkerdNamespace(t *testing.T) {
256234
}
257235

258236
for name, meshed := range tt.expectedRows {
259-
if err := validateRowStats(name, meshed, tt.status, rowStats, tt.isAuthority); err != nil {
237+
if err := validateRowStats(name, meshed, tt.status, rowStats); err != nil {
260238
return err
261239
}
262240
}
@@ -271,7 +249,7 @@ func TestCliStatForLinkerdNamespace(t *testing.T) {
271249
})
272250
}
273251

274-
func validateRowStats(name, expectedMeshCount, expectedStatus string, rowStats map[string]*testutil.RowStat, isAuthority bool) error {
252+
func validateRowStats(name, expectedMeshCount, expectedStatus string, rowStats map[string]*testutil.RowStat) error {
275253
stat, ok := rowStats[name]
276254
if !ok {
277255
return fmt.Errorf("No stats found for [%s]", name)
@@ -313,12 +291,5 @@ func validateRowStats(name, expectedMeshCount, expectedStatus string, rowStats m
313291
name, stat.P99Latency)
314292
}
315293

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-
323294
return nil
324295
}

0 commit comments

Comments
 (0)