diff --git a/bpf/kmesh/workload/cgroup_skb.c b/bpf/kmesh/workload/cgroup_skb.c index 9cb9662be..8b2cda898 100644 --- a/bpf/kmesh/workload/cgroup_skb.c +++ b/bpf/kmesh/workload/cgroup_skb.c @@ -11,7 +11,7 @@ #include "probe.h" #include "config.h" -volatile __u32 enable_periodic_report = 0; +volatile __u32 enable_periodic_report = 1; static inline bool is__periodic_report_enable() { diff --git a/test/e2e/baseline_test.go b/test/e2e/baseline_test.go index 3c1625246..11f8b0f6f 100644 --- a/test/e2e/baseline_test.go +++ b/test/e2e/baseline_test.go @@ -1,5 +1,3 @@ -//go:build integ -// +build integ /* * Copyright The Kmesh Authors. @@ -955,6 +953,63 @@ func TestL4Telemetry(t *testing.T) { }) } +func TestLongConnL4Telemetry(t *testing.T) { + framework.NewTest(t).Run(func(tc framework.TestContext) { + for _, src := range apps.EnrolledToKmesh { + for _, dst := range apps.EnrolledToKmesh { + tc.NewSubTestf("from %q to %q", src.Config().Service, dst.Config().Service).Run(func(stc framework.TestContext) { + localDst := dst + localSrc := src + opt := echo.CallOptions{ + Port: echo.Port{Name: "http"}, + Scheme: scheme.HTTP, + Count: 200, + Timeout: 1.5*60* time.Second, + Check: check.OK(), + HTTP: echo.HTTP{Path: "/?delay=3s", HTTP2: true}, + To: localDst, + NewConnectionPerRequest: false, + } + + go func() { + stc.Logf("sending continuous calls from %q to %q", deployName(localSrc), localDst.Config().Service) + start := time.Now() + localSrc.CallOrFail(stc, opt) + elapsed := time.Since(start) + stc.Logf("finished continuous calls from %q to %q in %v", deployName(localSrc), localDst.Config().Service, elapsed) + }() + query := buildL4Query(localSrc, localDst) + stc.Logf("prometheus query: %#v", query) + prevReqs := float64(0) + time.Sleep(5 * time.Second) + for range(2) { + err := retry.Until(func() bool { + reqs, err := prom.QuerySum(localSrc.Config().Cluster, query) + if err != nil { + stc.Logf("could not query for traffic from %q to %q: %v", deployName(localSrc), localDst.Config().Service, err) + return false + } + + if reqs-prevReqs == 0.0 { + stc.Logf("found zero-valued sum for traffic from %q to %q: %v", deployName(localSrc), localDst.Config().Service, err) + return false + } + prevReqs = reqs + return true + }, retry.Timeout(15*time.Second), retry.BackoffDelay(1*time.Second)) + if err != nil { + PromDiff(t, prom, localSrc.Config().Cluster, query) + stc.Errorf("could not validate L4 telemetry for %q to %q: %v", deployName(localSrc), localDst.Config().Service, err) + } + time.Sleep(15 * time.Second) + } + time.Sleep(1.5 * 60 * time.Second) + }) + } + } + }) +} + func buildL4Query(src, dst echo.Instance) prometheus.Query { query := prometheus.Query{} diff --git a/test/e2e/gateway_test.go b/test/e2e/gateway_test.go index 8ea613b49..cc9026360 100644 --- a/test/e2e/gateway_test.go +++ b/test/e2e/gateway_test.go @@ -1,5 +1,3 @@ -//go:build integ -// +build integ // CODE Copied and modified from https://github.com/istio/istio // more specifically: https://github.com/istio/istio/blob/master/pkg/test/framework/components/istio/ingress.go diff --git a/test/e2e/main_test.go b/test/e2e/main_test.go index 98522c73c..f1b019e51 100644 --- a/test/e2e/main_test.go +++ b/test/e2e/main_test.go @@ -1,5 +1,3 @@ -//go:build integ -// +build integ /* * Copyright The Kmesh Authors. diff --git a/test/e2e/manage_test.go b/test/e2e/manage_test.go index f80b9243a..2a0c61367 100644 --- a/test/e2e/manage_test.go +++ b/test/e2e/manage_test.go @@ -1,5 +1,3 @@ -//go:build integ -// +build integ /* * Copyright The Kmesh Authors. diff --git a/test/e2e/restart_test.go b/test/e2e/restart_test.go index 987c3d095..4eef41518 100644 --- a/test/e2e/restart_test.go +++ b/test/e2e/restart_test.go @@ -1,5 +1,3 @@ -//go:build integ -// +build integ /* * Copyright The Kmesh Authors.