test: add TLS mixed soak with paced clients

This commit is contained in:
2026-09-23 10:18:49 +08:00
parent 830cb3a7ad
commit dfe8a1a9af
5 changed files with 324 additions and 9 deletions

View File

@@ -22,14 +22,7 @@ import (
// verification. Linux acceptance runs set GO_OMNI_HTTP2_SOAK_DURATION=30m.
func TestTLSSoak(t *testing.T) {
started := time.Now()
duration := 3 * time.Second
if value := os.Getenv("GO_OMNI_HTTP2_SOAK_DURATION"); value != "" {
parsed, err := time.ParseDuration(value)
if err != nil || parsed <= 0 {
t.Fatalf("invalid GO_OMNI_HTTP2_SOAK_DURATION %q: %v", value, err)
}
duration = parsed
}
duration := soakDuration(t)
logSoakResources(t, started, "before", 0, 0, Stats{})
certificate, roots := testCertificate(t)
@@ -172,6 +165,18 @@ func TestTLSSoak(t *testing.T) {
}
}
func soakDuration(t *testing.T) time.Duration {
t.Helper()
if value := os.Getenv("GO_OMNI_HTTP2_SOAK_DURATION"); value != "" {
duration, err := time.ParseDuration(value)
if err != nil || duration <= 0 {
t.Fatalf("invalid GO_OMNI_HTTP2_SOAK_DURATION %q: %v", value, err)
}
return duration
}
return 3 * time.Second
}
// These measurements cover the client and server in the same test process.
// RSS includes race runtime allocations that do not appear in Go heap stats.
func logSoakResources(t *testing.T, started time.Time, phase string, requests, failures uint64, stats Stats) {