@@ -24,12 +24,10 @@ import (
2424 "net/http"
2525 "net/http/httputil"
2626 "regexp"
27- "slices"
2827 "strings"
2928 "testing"
3029 "time"
3130
32- "golang.org/x/sync/errgroup"
3331 corev1 "k8s.io/api/core/v1"
3432 gwconfig "sigs.k8s.io/gateway-api/conformance/utils/config"
3533 gwhttp "sigs.k8s.io/gateway-api/conformance/utils/http"
@@ -401,36 +399,3 @@ func formatDump(data []byte, prefix string) string {
401399 data = startLineRegex .ReplaceAllLiteral (data , []byte (prefix ))
402400 return string (data )
403401}
404-
405- func AssertTrafficOnlyReachesToExpectedPods (t * testing.T , r roundtripper.RoundTripper , gwAddr string , expected gwhttp.ExpectedResponse , requestBody string , expectedPodNames []string ) {
406- t .Helper ()
407- const (
408- concurrentRequests = 10
409- totalRequests = 100
410- )
411- var (
412- g errgroup.Group
413- req = gwhttp .MakeRequest (t , & expected , gwAddr , "HTTP" , "http" )
414- )
415- g .SetLimit (concurrentRequests )
416- for i := 0 ; i < totalRequests ; i ++ {
417- g .Go (func () error {
418- cReq , cRes , err := MakeCallRoundTripper (t , r , & RequestWithBody {Request : req , Body : strings .NewReader (requestBody )})
419- if err != nil {
420- return fmt .Errorf ("failed to roundtrip request: %w" , err )
421- }
422- if err := gwhttp .CompareRequest (t , & req , cReq , cRes , expected ); err != nil {
423- return fmt .Errorf ("response expectation failed for request: %w" , err )
424- }
425-
426- if slices .Contains (expectedPodNames , cReq .Pod ) {
427- return nil
428- }
429- return fmt .Errorf ("request was handled by an unexpected pod %q" , cReq .Pod )
430- })
431- }
432- if err := g .Wait (); err != nil {
433- t .Fatalf ("Not all the requests are sent to the expectedPods successfully, err: %v" , err )
434- }
435- tlog .Logf (t , "Traffic successfully reached only to expected pods: %v" , expectedPodNames )
436- }
0 commit comments