Skip to content

Commit 577c8d9

Browse files
committed
Look at values file too to determine if mtls is enabled for the test or not.
1 parent 2ca7d77 commit 577c8d9

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

pkg/test/framework/runtime/components/environment/kube/environment.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@ import (
1818
"bytes"
1919
"fmt"
2020
"io"
21+
"path/filepath"
2122
"strings"
2223
"testing"
2324
"text/template"
2425

2526
"github.com/google/uuid"
2627
multierror "github.com/hashicorp/go-multierror"
28+
yaml2 "gopkg.in/yaml.v2"
2729

30+
"istio.io/istio/pkg/test"
2831
"istio.io/istio/pkg/test/deployment"
2932
"istio.io/istio/pkg/test/framework/api/component"
3033
"istio.io/istio/pkg/test/framework/api/context"
@@ -92,12 +95,31 @@ func (e *Environment) Scope() lifecycle.Scope {
9295
return e.scope
9396
}
9497

95-
// Is mtls enabled
98+
// Is mtls enabled. Check in Values flag and Values file.
9699
func (e *Environment) IsMtlsEnabled() bool {
97100
if e.s.Values["global.mtls.enabled"] == "true" {
98101
return true
99102
}
100103

104+
data, err := test.ReadConfigFile(filepath.Join(e.s.ChartDir, e.s.ValuesFile))
105+
if err != nil {
106+
return false
107+
}
108+
m := make(map[interface{}]interface{})
109+
err = yaml2.Unmarshal([]byte(data), &m)
110+
if err != nil {
111+
return false
112+
}
113+
if m["global"] != nil {
114+
switch globalVal := m["global"].(type) {
115+
case map[interface{}]interface{}:
116+
switch mtlsVal := globalVal["mtls"].(type) {
117+
case map[interface{}]interface{}:
118+
return mtlsVal["enabled"].(bool)
119+
}
120+
}
121+
}
122+
101123
return false
102124
}
103125

tests/integration2/mixer/scenarios_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ func TestTcpMetric(t *testing.T) {
146146
visitProductPage(ingress, 30*time.Second, 200, t)
147147

148148
query := fmt.Sprintf("sum(istio_tcp_sent_bytes_total{destination_app=\"%s\"})", "mongodb")
149-
150149
validateMetric(t, prometheus, query, "istio_tcp_sent_bytes_total")
151150

152151
query = fmt.Sprintf("sum(istio_tcp_received_bytes_total{destination_app=\"%s\"})", "mongodb")

0 commit comments

Comments
 (0)