@@ -19,20 +19,22 @@ import (
1919 "github.com/stretchr/testify/require"
2020 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121 gwaiev1a2 "sigs.k8s.io/gateway-api-inference-extension/api/v1alpha2"
22+
23+ "github.com/envoyproxy/ai-gateway/tests/internal/e2elib"
2224)
2325
2426// TestInferencePoolIntegration tests the InferencePool integration with AI Gateway.
2527func TestInferencePoolIntegration (t * testing.T ) {
2628 // Apply the base test manifest.
2729 const baseManifest = "../../examples/inference-pool/base.yaml"
28- require .NoError (t , kubectlApplyManifest (t .Context (), baseManifest ))
30+ require .NoError (t , e2elib . KubectlApplyManifest (t .Context (), baseManifest ))
2931
3032 // Test inferencePool with AIGatewayRoute.
3133 const aiGWRouteManifest = "../../examples/inference-pool/aigwroute.yaml"
32- require .NoError (t , kubectlApplyManifest (t .Context (), aiGWRouteManifest ))
34+ require .NoError (t , e2elib . KubectlApplyManifest (t .Context (), aiGWRouteManifest ))
3335
3436 egSelector := "gateway.envoyproxy.io/owning-gateway-name=inference-pool-with-aigwroute"
35- requireWaitForGatewayPodReady (t , egSelector )
37+ e2elib . RequireWaitForGatewayPodReady (t , egSelector )
3638
3739 // Verify InferencePool status is correctly set for the Gateway.
3840 t .Run ("verify_inference_pool_status" , func (t * testing.T ) {
@@ -93,15 +95,15 @@ func TestInferencePoolIntegration(t *testing.T) {
9395 })
9496
9597 t .Cleanup (func () {
96- _ = kubectlDeleteManifest (context .Background (), aiGWRouteManifest )
98+ _ = e2elib . KubectlDeleteManifest (context .Background (), aiGWRouteManifest )
9799 })
98100
99101 // Test inferencePool with HTTPRoute.
100102 const httpRouteManifest = "../../examples/inference-pool/httproute.yaml"
101- require .NoError (t , kubectlApplyManifest (t .Context (), httpRouteManifest ))
103+ require .NoError (t , e2elib . KubectlApplyManifest (t .Context (), httpRouteManifest ))
102104
103105 egSelector = "gateway.envoyproxy.io/owning-gateway-name=inference-pool-with-httproute"
104- requireWaitForPodReady (t , egSelector )
106+ e2elib . RequireWaitForPodReady (t , egSelector )
105107
106108 // Verify InferencePool status is correctly set for the HTTPRoute Gateway.
107109 t .Run ("verify_inference_pool_status_httproute" , func (t * testing.T ) {
@@ -116,7 +118,7 @@ func TestInferencePoolIntegration(t *testing.T) {
116118 })
117119
118120 t .Cleanup (func () {
119- _ = kubectlDeleteManifest (context .Background (), httpRouteManifest )
121+ _ = e2elib . KubectlDeleteManifest (context .Background (), httpRouteManifest )
120122 })
121123}
122124
@@ -130,16 +132,16 @@ func testInferenceGatewayConnectivityByModel(t *testing.T, egSelector, model str
130132// testInferenceGatewayConnectivity tests that the InferenceGateway is working as expected and returns a expected status code.
131133func testInferenceGatewayConnectivity (t * testing.T , egSelector , body string , additionalHeaders map [string ]string , expectedStatusCode int ) {
132134 require .Eventually (t , func () bool {
133- fwd := requireNewHTTPPortForwarder (t , egNamespace , egSelector , egDefaultServicePort )
134- defer fwd .kill ()
135+ fwd := e2elib . RequireNewHTTPPortForwarder (t , e2elib . EnvoyGatewayNamespace , egSelector , e2elib . EnvoyGatewayDefaultServicePort )
136+ defer fwd .Kill ()
135137
136138 // Set timeout context.
137139 ctx , cancel := context .WithTimeout (t .Context (), 10 * time .Second )
138140 defer cancel ()
139141 // Create a request to the InferencePool backend with the correct model header.
140142 requestBody := body
141143 t .Logf ("Request body: %s" , requestBody )
142- req , err := http .NewRequestWithContext (ctx , http .MethodPost , fwd .address ()+ "/v1/chat/completions" , strings .NewReader (requestBody ))
144+ req , err := http .NewRequestWithContext (ctx , http .MethodPost , fwd .Address ()+ "/v1/chat/completions" , strings .NewReader (requestBody ))
143145 require .NoError (t , err )
144146 // Set required headers for InferencePool routing.
145147 req .Header .Set ("Content-Type" , "application/json" )
0 commit comments