|
1 | | -//go:build integ |
2 | | -// +build integ |
3 | 1 |
|
4 | 2 | /* |
5 | 3 | * Copyright The Kmesh Authors. |
@@ -955,6 +953,58 @@ func TestL4Telemetry(t *testing.T) { |
955 | 953 | }) |
956 | 954 | } |
957 | 955 |
|
| 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 | + |
958 | 1008 | func buildL4Query(src, dst echo.Instance) prometheus.Query { |
959 | 1009 | query := prometheus.Query{} |
960 | 1010 |
|
|
0 commit comments