@@ -157,10 +157,6 @@ func DefaultOptions(t *testing.T) confsuite.ConformanceOptions {
157157 * confflags .ImplementationContact ,
158158 )
159159
160- // Inference Extension Specific Report Fields
161- inferenceExtensionVersion := "v0.3.0"
162- _ = inferenceExtensionVersion // Avoid unused variable error until implemented
163-
164160 baseManifestsValue := "resources/manifests/manifests.yaml"
165161
166162 opts := confsuite.ConformanceOptions {
@@ -189,7 +185,6 @@ func DefaultOptions(t *testing.T) confsuite.ConformanceOptions {
189185 // TODO: Add the inference extension specific fields to ConformanceOptions struct if needed,
190186 // or handle them during report generation.
191187 // GatewayAPIInferenceExtensionChannel: inferenceExtensionChannel,
192- // GatewayAPIInferenceExtensionVersion: inferenceExtensionVersion,
193188 }
194189
195190 // Populate SupportedFeatures based on the GatewayLayerProfile.
@@ -232,19 +227,28 @@ func RunConformanceWithOptions(t *testing.T, opts confsuite.ConformanceOptions)
232227 cSuite , err := confsuite .NewConformanceTestSuite (opts )
233228 require .NoError (t , err , "error initializing conformance suite" )
234229
230+ installedCRDs := & apiextensionsv1.CustomResourceDefinitionList {}
231+ err = opts .Client .List (context .TODO (), installedCRDs )
232+ require .NoError (t , err , "error getting installedCRDs" )
233+ apiVersion , err := getGatewayInferenceExtentionVersion (installedCRDs .Items )
234+ if err != nil {
235+ if opts .AllowCRDsMismatch {
236+ apiVersion = "UNDEFINED"
237+ } else {
238+ require .NoError (t , err , "error getting the gateway ineference extension version" )
239+ }
240+ }
235241 SetupConformanceTestSuite (t , cSuite , opts , tests .ConformanceTests )
236-
237242 t .Log ("Running Inference Extension conformance tests against all registered tests" )
238243 err = cSuite .Run (t , tests .ConformanceTests )
239244 require .NoError (t , err , "error running conformance tests" )
240245
241- // Generate and write the report if requested.
242246 if opts .ReportOutputPath != "" {
243247 t .Log ("Generating Inference Extension conformance report" )
244248 report , err := cSuite .Report () // Use the existing report generation logic.
245249 require .NoError (t , err , "error generating conformance report" )
246250 inferenceReport := GatewayAPIInferenceExtensionConformanceReport {
247- GatewayAPIInferenceExtensionVersion : version . BundleVersion ,
251+ GatewayAPIInferenceExtensionVersion : apiVersion ,
248252 ConformanceReport : * report ,
249253 }
250254 err = inferenceReport .WriteReport (t .Logf , opts .ReportOutputPath )
@@ -284,6 +288,24 @@ func SetupConformanceTestSuite(t *testing.T, suite *confsuite.ConformanceTestSui
284288 ensureGatewayAvailableAndReady (t , suite .Client , opts , secondaryGatewayNN )
285289}
286290
291+ func getGatewayInferenceExtentionVersion (crds []apiextensionsv1.CustomResourceDefinition ) (string , error ) {
292+ var inferenceVersion string
293+ for _ , crd := range crds {
294+ v , okv := crd .Annotations [version .BundleVersionAnnotation ]
295+ if ! okv {
296+ continue
297+ }
298+ if inferenceVersion != "" && v != inferenceVersion {
299+ return "" , errors .New ("multiple gateway api inference extension CRDs versions detected" )
300+ }
301+ inferenceVersion = v
302+ }
303+ if inferenceVersion == "" {
304+ return "" , errors .New ("no gateway api inference extension CRDs with the proper annotations found in the cluster" )
305+ }
306+ return inferenceVersion , nil
307+ }
308+
287309// ensureGatewayAvailableAndReady polls for the specified Gateway to exist and become ready
288310// with an address and programmed condition.
289311func ensureGatewayAvailableAndReady (t * testing.T , k8sClient client.Client , opts confsuite.ConformanceOptions , gatewayNN types.NamespacedName ) {
0 commit comments