From 4e54e9bfdcf71750a4f8b532e032ad97b0e2ea87 Mon Sep 17 00:00:00 2001 From: Edward McFarlane Date: Fri, 3 Nov 2023 10:24:29 -0400 Subject: [PATCH 1/5] Increase concurrent streams to test limits --- connect_ext_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connect_ext_test.go b/connect_ext_test.go index af541259..dc19625c 100644 --- a/connect_ext_test.go +++ b/connect_ext_test.go @@ -475,7 +475,7 @@ func TestConcurrentStreams(t *testing.T) { server := memhttptest.NewServer(t, mux) var done, start sync.WaitGroup start.Add(1) - for i := 0; i < 100; i++ { + for i := 0; i < 1000; i++ { done.Add(1) go func() { defer done.Done() From 721fdb9560ef082196e1697b5159f5de1d4f83a4 Mon Sep 17 00:00:00 2001 From: Edward McFarlane Date: Fri, 3 Nov 2023 10:37:38 -0400 Subject: [PATCH 2/5] Bound concurrency to NumCPU to limit test resources --- connect_ext_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/connect_ext_test.go b/connect_ext_test.go index dc19625c..e383c9ee 100644 --- a/connect_ext_test.go +++ b/connect_ext_test.go @@ -26,6 +26,7 @@ import ( "math" "math/rand" "net/http" + "runtime" "strings" "sync" "testing" @@ -475,7 +476,7 @@ func TestConcurrentStreams(t *testing.T) { server := memhttptest.NewServer(t, mux) var done, start sync.WaitGroup start.Add(1) - for i := 0; i < 1000; i++ { + for i := 0; i < runtime.NumCPU()*2; i++ { done.Add(1) go func() { defer done.Done() From 3ac5bc27bf455b63e7a8c213d7fa34effba401c1 Mon Sep 17 00:00:00 2001 From: Edward McFarlane Date: Fri, 3 Nov 2023 12:54:16 -0400 Subject: [PATCH 3/5] Use GOMAXPROCS --- connect_ext_test.go | 2 +- internal/memhttp/memhttp_test.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/connect_ext_test.go b/connect_ext_test.go index e383c9ee..593a1141 100644 --- a/connect_ext_test.go +++ b/connect_ext_test.go @@ -476,7 +476,7 @@ func TestConcurrentStreams(t *testing.T) { server := memhttptest.NewServer(t, mux) var done, start sync.WaitGroup start.Add(1) - for i := 0; i < runtime.NumCPU()*2; i++ { + for i := 0; i < runtime.GOMAXPROCS(0)*2; i++ { done.Add(1) go func() { defer done.Done() diff --git a/internal/memhttp/memhttp_test.go b/internal/memhttp/memhttp_test.go index 06e11ee4..a12532c9 100644 --- a/internal/memhttp/memhttp_test.go +++ b/internal/memhttp/memhttp_test.go @@ -19,6 +19,7 @@ import ( "fmt" "io" "net/http" + "runtime" "sync" "testing" "time" @@ -30,7 +31,7 @@ import ( func TestServerTransport(t *testing.T) { t.Parallel() - const concurrency = 100 + concurrency := runtime.GOMAXPROCS(0) * 2 const greeting = "Hello, world!" handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { From d5cc01478a22c1a18fa760cca520f1e120a5b72f Mon Sep 17 00:00:00 2001 From: Edward McFarlane Date: Thu, 9 Nov 2023 10:46:29 -0500 Subject: [PATCH 4/5] Fail to check settings --- connect_ext_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/connect_ext_test.go b/connect_ext_test.go index 593a1141..f289f92a 100644 --- a/connect_ext_test.go +++ b/connect_ext_test.go @@ -511,6 +511,8 @@ func TestConcurrentStreams(t *testing.T) { } start.Done() done.Wait() + t.Error("NUMCPU", runtime.NumCPU()) + t.Error("GOMAXPROCS", runtime.GOMAXPROCS(0)) } func TestHeaderBasic(t *testing.T) { From e96582b273b184f977ee588b54144366790332f1 Mon Sep 17 00:00:00 2001 From: Edward McFarlane Date: Thu, 9 Nov 2023 10:57:59 -0500 Subject: [PATCH 5/5] Bump to 8 --- connect_ext_test.go | 4 +--- internal/memhttp/memhttp_test.go | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/connect_ext_test.go b/connect_ext_test.go index f289f92a..e6b5a6eb 100644 --- a/connect_ext_test.go +++ b/connect_ext_test.go @@ -476,7 +476,7 @@ func TestConcurrentStreams(t *testing.T) { server := memhttptest.NewServer(t, mux) var done, start sync.WaitGroup start.Add(1) - for i := 0; i < runtime.GOMAXPROCS(0)*2; i++ { + for i := 0; i < runtime.GOMAXPROCS(0)*8; i++ { done.Add(1) go func() { defer done.Done() @@ -511,8 +511,6 @@ func TestConcurrentStreams(t *testing.T) { } start.Done() done.Wait() - t.Error("NUMCPU", runtime.NumCPU()) - t.Error("GOMAXPROCS", runtime.GOMAXPROCS(0)) } func TestHeaderBasic(t *testing.T) { diff --git a/internal/memhttp/memhttp_test.go b/internal/memhttp/memhttp_test.go index a12532c9..9218f7ed 100644 --- a/internal/memhttp/memhttp_test.go +++ b/internal/memhttp/memhttp_test.go @@ -31,7 +31,7 @@ import ( func TestServerTransport(t *testing.T) { t.Parallel() - concurrency := runtime.GOMAXPROCS(0) * 2 + concurrency := runtime.GOMAXPROCS(0) * 8 const greeting = "Hello, world!" handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {