-
Notifications
You must be signed in to change notification settings - Fork 132
E2E tests for long_tcp_conns metrics and accesslogs #1330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1374efd
ea6e006
556ba40
b7afeff
0550758
b812676
654311b
90612e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This flag will only take effect for HTTP2/3 but not HTTP1.1, ref: https://github.com/istio/istio/blob/master/pkg/test/echo/server/forwarder/http.go#L133 Also metioned here: https://github.com/istio/istio/blob/master/tests/integration/ambient/baseline_test.go#L345 So use HTTP2 instead, https://github.com/istio/istio/blob/master/tests/integration/ambient/baseline_test.go#L346 |
||
| } | ||
|
|
||
| go func() { | ||
| stc.Logf("sending continuous calls from %q to %q", deployName(localSrc), localDst.Config().Service) | ||
| start := time.Now() | ||
| localSrc.CallOrFail(stc, opt) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In addition this test wants to get metrics during the long connection process? However this function call is synchronous, and when it returns, the connection has been terminated. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what about running this function in another go routine ?? |
||
| 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{} | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| //go:build integ | ||
| // +build integ | ||
|
|
||
| /* | ||
| * Copyright The Kmesh Authors. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| //go:build integ | ||
| // +build integ | ||
|
|
||
| /* | ||
| * Copyright The Kmesh Authors. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| //go:build integ | ||
| // +build integ | ||
|
|
||
| /* | ||
| * Copyright The Kmesh Authors. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this setting will not take effect, ref:
https://github.com/istio/istio/blob/master/pkg/test/framework/components/echo/calloptions.go#L151
https://github.com/istio/istio/blob/master/pkg/test/framework/components/echo/calloptions.go#L329
You should use HTTP and set a sufficiently long delay for each request:
https://github.com/kmesh-net/kmesh/blob/main/test/e2e/baseline_test.go#L931