@@ -157,10 +157,6 @@ func DefaultOptions(t *testing.T) confsuite.ConformanceOptions {
157
157
* confflags .ImplementationContact ,
158
158
)
159
159
160
- // Inference Extension Specific Report Fields
161
- inferenceExtensionVersion := "v0.3.0"
162
- _ = inferenceExtensionVersion // Avoid unused variable error until implemented
163
-
164
160
baseManifestsValue := "resources/manifests/manifests.yaml"
165
161
166
162
opts := confsuite.ConformanceOptions {
@@ -189,7 +185,6 @@ func DefaultOptions(t *testing.T) confsuite.ConformanceOptions {
189
185
// TODO: Add the inference extension specific fields to ConformanceOptions struct if needed,
190
186
// or handle them during report generation.
191
187
// GatewayAPIInferenceExtensionChannel: inferenceExtensionChannel,
192
- // GatewayAPIInferenceExtensionVersion: inferenceExtensionVersion,
193
188
}
194
189
195
190
// Populate SupportedFeatures based on the GatewayLayerProfile.
@@ -232,19 +227,28 @@ func RunConformanceWithOptions(t *testing.T, opts confsuite.ConformanceOptions)
232
227
cSuite , err := confsuite .NewConformanceTestSuite (opts )
233
228
require .NoError (t , err , "error initializing conformance suite" )
234
229
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
+ }
235
241
SetupConformanceTestSuite (t , cSuite , opts , tests .ConformanceTests )
236
-
237
242
t .Log ("Running Inference Extension conformance tests against all registered tests" )
238
243
err = cSuite .Run (t , tests .ConformanceTests )
239
244
require .NoError (t , err , "error running conformance tests" )
240
245
241
- // Generate and write the report if requested.
242
246
if opts .ReportOutputPath != "" {
243
247
t .Log ("Generating Inference Extension conformance report" )
244
248
report , err := cSuite .Report () // Use the existing report generation logic.
245
249
require .NoError (t , err , "error generating conformance report" )
246
250
inferenceReport := GatewayAPIInferenceExtensionConformanceReport {
247
- GatewayAPIInferenceExtensionVersion : version . BundleVersion ,
251
+ GatewayAPIInferenceExtensionVersion : apiVersion ,
248
252
ConformanceReport : * report ,
249
253
}
250
254
err = inferenceReport .WriteReport (t .Logf , opts .ReportOutputPath )
@@ -284,6 +288,24 @@ func SetupConformanceTestSuite(t *testing.T, suite *confsuite.ConformanceTestSui
284
288
ensureGatewayAvailableAndReady (t , suite .Client , opts , secondaryGatewayNN )
285
289
}
286
290
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
+
287
309
// ensureGatewayAvailableAndReady polls for the specified Gateway to exist and become ready
288
310
// with an address and programmed condition.
289
311
func ensureGatewayAvailableAndReady (t * testing.T , k8sClient client.Client , opts confsuite.ConformanceOptions , gatewayNN types.NamespacedName ) {
0 commit comments