Skip to content

Commit 1374efd

Browse files
committed
e2e test for long_conn metrics
Signed-off-by: Yash Patel <yp969803@gmail.com>
1 parent 98facf9 commit 1374efd

File tree

5 files changed

+52
-10
lines changed

5 files changed

+52
-10
lines changed

test/e2e/baseline_test.go

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//go:build integ
2-
// +build integ
31

42
/*
53
* Copyright The Kmesh Authors.
@@ -955,6 +953,58 @@ func TestL4Telemetry(t *testing.T) {
955953
})
956954
}
957955

956+
func TestLongConnL4Telemetry(t *testing.T) {
957+
framework.NewTest(t).Run(func(tc framework.TestContext) {
958+
for _, src := range apps.EnrolledToKmesh {
959+
for _, dst := range apps.EnrolledToKmesh {
960+
tc.NewSubTestf("from %q to %q", src.Config().Service, dst.Config().Service).Run(func(stc framework.TestContext) {
961+
localDst := dst
962+
localSrc := src
963+
opt := echo.CallOptions{
964+
Port: echo.Port{Name: "http"},
965+
Scheme: scheme.HTTP,
966+
Count: 20,
967+
Timeout: 1.5*60* time.Second,
968+
Check: check.OK(),
969+
HTTP: echo.HTTP{Path: "/?delay=3s", HTTP2: true},
970+
To: localDst,
971+
NewConnectionPerRequest: false,
972+
}
973+
974+
stc.Logf("sending continuous calls from %q to %q", deployName(localSrc), localDst.Config().Service)
975+
go localSrc.CallOrFail(stc, opt)
976+
977+
query := buildL4Query(localSrc, localDst)
978+
stc.Logf("prometheus query: %#v", query)
979+
prevReqs := float64(0)
980+
for i := 0; i < 2; i++ {
981+
err := retry.Until(func() bool {
982+
reqs, err := prom.QuerySum(localSrc.Config().Cluster, query)
983+
if err != nil {
984+
stc.Logf("could not query for traffic from %q to %q: %v", deployName(localSrc), localDst.Config().Service, err)
985+
return false
986+
}
987+
988+
if reqs-prevReqs == 0.0 {
989+
stc.Logf("found zero-valued sum for traffic from %q to %q: %v", deployName(localSrc), localDst.Config().Service, err)
990+
return false
991+
}
992+
prevReqs = reqs
993+
return true
994+
}, retry.Timeout(15*time.Second), retry.BackoffDelay(1*time.Second))
995+
if err != nil {
996+
PromDiff(t, prom, localSrc.Config().Cluster, query)
997+
stc.Errorf("could not validate L4 telemetry for %q to %q: %v", deployName(localSrc), localDst.Config().Service, err)
998+
}
999+
time.Sleep(15 * time.Second)
1000+
}
1001+
time.Sleep(2 * 60 * time.Second)
1002+
})
1003+
}
1004+
}
1005+
})
1006+
}
1007+
9581008
func buildL4Query(src, dst echo.Instance) prometheus.Query {
9591009
query := prometheus.Query{}
9601010

test/e2e/gateway_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//go:build integ
2-
// +build integ
31

42
// CODE Copied and modified from https://github.com/istio/istio
53
// more specifically: https://github.com/istio/istio/blob/master/pkg/test/framework/components/istio/ingress.go

test/e2e/main_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//go:build integ
2-
// +build integ
31

42
/*
53
* Copyright The Kmesh Authors.

test/e2e/manage_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//go:build integ
2-
// +build integ
31

42
/*
53
* Copyright The Kmesh Authors.

test/e2e/restart_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//go:build integ
2-
// +build integ
31

42
/*
53
* Copyright The Kmesh Authors.

0 commit comments

Comments
 (0)