@@ -92,26 +92,28 @@ var GatewayFollowingEPPRoutingWithDataParallelism = suite.ConformanceTest{
9292 }`
9393
9494 // Single-pod pin to ensure header filter works before main test cases.
95- gwhttp .MakeRequestAndExpectEventuallyConsistentResponse (
96- t ,
97- s .RoundTripper ,
98- s .TimeoutConfig ,
99- gwAddr ,
100- gwhttp.ExpectedResponse {
101- Request : gwhttp.Request {
102- Host : hostname ,
103- Path : path ,
104- Method : http .MethodPost ,
105- Body : requestBody ,
106- Headers : map [string ]string {
107- test .HeaderTestEppEndPointSelectionKey : backends [0 ].IP ,
95+ for _ , backend := range backends {
96+ gwhttp .MakeRequestAndExpectEventuallyConsistentResponse (
97+ t ,
98+ s .RoundTripper ,
99+ s .TimeoutConfig ,
100+ gwAddr ,
101+ gwhttp.ExpectedResponse {
102+ Request : gwhttp.Request {
103+ Host : hostname ,
104+ Path : path ,
105+ Method : http .MethodPost ,
106+ Body : requestBody ,
107+ Headers : map [string ]string {
108+ test .HeaderTestEppEndPointSelectionKey : backend .IP ,
109+ },
108110 },
111+ Response : gwhttp.Response {StatusCodes : []int {http .StatusOK }},
112+ Backend : backend .Name ,
113+ Namespace : resources .AppBackendNamespace ,
109114 },
110- Response : gwhttp.Response {StatusCodes : []int {http .StatusOK }},
111- Backend : backends [0 ].Name ,
112- Namespace : resources .AppBackendNamespace ,
113- },
114- )
115+ )
116+ }
115117
116118 testCases := []struct {
117119 name string
@@ -208,38 +210,37 @@ func assertTrafficOnlyReachesToExpectedPodsDP(
208210 if err := gwhttp .CompareRoundTrip (t , & r , cReq , cRes , expected ); err != nil {
209211 return fmt .Errorf ("expectation failed: %w" , err )
210212 }
211- // Enforce no leakage to non-selected pods (ports/ranks are internal) .
213+ // Enforce no leakage to non-selected pods.
212214 if ! slices .Contains (expectedPodNames , cReq .Pod ) {
213215 return fmt .Errorf ("unexpected pod %q (expected one of %v)" , cReq .Pod , expectedPodNames )
214216 }
215217
216- // Validate X-Echo-HTTP-Port vs EPP intent for the pod's IP.
217- portHdr := getHeaderValue (cRes .Headers , "X-Echo-HTTP-Port" ) // Header set by backend echo server
218- if portHdr == "" {
219- return errors .New ("missing X-Echo-HTTP-Port response header" )
218+ // Validate httpPort from JSON response body vs EPP intent.
219+ if cReq .HTTPPort == "" {
220+ return errors .New ("missing httpPort in echo JSON body response" )
220221 }
221222 ip := podNameToIP [cReq .Pod ]
222223 allowed , ok := ipToAllowedPorts [ip ]
223224 if ! ok {
224225 return fmt .Errorf ("pod %q (IP %s) not present in EPP selection" , cReq .Pod , ip )
225226 }
226227 if len (allowed ) > 0 {
227- if _ , ok := allowed [portHdr ]; ! ok {
228- return fmt .Errorf ("unexpected X-Echo-HTTP-Port %q for IP %s (allowed: %v)" , portHdr , ip , keys (allowed ))
228+ if _ , ok := allowed [cReq . HTTPPort ]; ! ok {
229+ return fmt .Errorf ("unexpected httpPort %q for IP %s (allowed: %v)" , cReq . HTTPPort , ip , keys (allowed ))
229230 }
230231 } else {
231- if _ , ok := dpPorts [portHdr ]; ! ok {
232- return fmt .Errorf ("unexpected X-Echo-HTTP-Port %q for IP %s (expected one of DP ports %v)" , portHdr , ip , keys (dpPorts ))
232+ if _ , ok := dpPorts [cReq . HTTPPort ]; ! ok {
233+ return fmt .Errorf ("unexpected httpPort %q for IP %s (expected one of ports %v)" , cReq . HTTPPort , ip , keys (dpPorts ))
233234 }
234235 }
235236
236237 return nil
237238 })
238239 }
239240 if err := g .Wait (); err != nil {
240- t .Fatalf ("Requests were not confined to expected pods (DP) or failed port-header checks: %v" , err )
241+ t .Fatalf ("Requests were not confined to expected pods or failed port checks: %v" , err )
241242 }
242- t .Logf ("DP traffic restricted to %v and port header validated against EPP selection" , expectedPodNames )
243+ t .Logf ("Traffic restricted to %v and httpPort validated against EPP selection" , expectedPodNames )
243244}
244245
245246type portSet map [string ]struct {}
@@ -258,19 +259,8 @@ func keys(m portSet) []string {
258259 return out
259260}
260261
261- // getHeaderValue is a case-insensitive header lookup on headers using the key.
262- func getHeaderValue (headers map [string ][]string , key string ) string {
263- for k , v := range headers {
264- if strings .EqualFold (k , key ) && len (v ) > 0 {
265- return v [0 ]
266- }
267- }
268- return ""
269- }
270-
271- // buildEPPHeader builds the test EPP header (HeaderTestEppEndPointSelectionKey) from ip->ports.
272- // Empty portSet => emit just "IP". Non-empty => emit "IP:port" for each port.
273- // Sorted for determinism.
262+ // buildEPPHeader builds the test EPP header from ip->ports. AN empty portSet => emit just "IP".
263+ // A non-empty => emit "IP:port" for each port. Sorted for determinism.
274264func buildEPPHeader (ipToPorts map [string ]portSet ) string {
275265 ips := make ([]string , 0 , len (ipToPorts ))
276266 for ip := range ipToPorts {
0 commit comments